Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add @LOCALE@ macro for translation #166

Merged
merged 5 commits into from
Oct 10, 2015

Conversation

mizunashi-mana
Copy link
Contributor

From Issue #158

Feature

The reason why I chose the name, @Locale@

First, I chose @lang@ .
But, @lang@ conflicted with translation plugin's. (If we use page template and write {{page>@LANG@}} on this page, when a instance be created with the template, it is transformed to {{page>en}} or others.)
So, I picked this.

However, I hesitate to judge.
There are @lc@, @INC_LANG@, etc.
Do you have better name?

Macro change flow

  1. Getting HTTP_ACCEPT_LANGUAGE from HTTP header
  2. Try to translate page name and test to exist the page
  3. If the page exists, this macro value is set
  4. If there are many accept languages, check each items in the order
  5. Else the macro sets wiki default

Changes

  • apply_macro function is changed to use resolve_pageid function.

Mizunashi Mana added 3 commits May 20, 2015 03:39
Because @lang@ conflicts translation plugin's
@michitux
Copy link
Member

What about HTTP_LANG or BROWSER_LANG in order to make clear that the language code is from the current request? All in all this seems to be okay in my opinion.

@mizunashi-mana
Copy link
Contributor Author

Thx! BROWSER_LANG seems more than to me!
I will fix.

@mizunashi-mana
Copy link
Contributor Author

Sorry...
I wrote codes with less survey.

I fixed HTTP_ACCEPT_LANGUAGE pattern based on
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4

michitux added a commit that referenced this pull request Oct 10, 2015
Add @BROWSER_LANG@ macro for translation
@michitux michitux merged commit 0474183 into dokufreaks:master Oct 10, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants