[aur-dev] patch for AUR about setting the DEFAULT_LANG
Loui Chang, and other guys: When i port a chinese version AUR, I fount this bug. That once i setting a default language to sth(eg: zh_CN) by change DEFAULT_LANG macr define in web/lib/config.inc, it won't work, and this language page(here is zh_CN) could not show its native strings. Then i turn back to check if i got a wrong spelling. But i fount the developer have told us that options couldn't be change(in web/lib/config.inc, line 48). So I think maybe its a bug which havn't been fixed. After i check all the code about language setting, i think i got the reason. We have two problems which cause that bug. First, in .../web/lib/aur.inc, between line 296 to line 298. Even the $LANG==DEFAULT_LANG, we should include the $LANG.po file. Because once the DEFAULT_LANG isn't english, we also need translate the strings. So i just suggest add an 'else' branch after line 298 to include DEFAULT_LANG.po.such as"else{include_once(DEFAULT_LANG.".po";)}" Second, in .../web/lib/translator.inc, between line 52 to line 62. The reason is as the same as i said above. If we havn't set a $LANG var, the $LANG will be set to DEFAULT_LANG. But the DEFAULT_LANG doesn't mean english. Even the $LANG havn't been set, the $_t maybe setting (see Firest above) when include from DEFAULT_LANG.po. We should also translate them. So i think we should remove the 'else' identify. make the 'else' branch work for ever. By the way if the function "include_lang()" in .../web/lib/translator.inc, between line 32 to line 40 is an old function to make the lang func? Maybe we should remove them. PS: I prepare to make a mirror for our AUR to chinese people, how could i got the databases an files from aur.archlinux.org. OR i couldn't make a mirror for that. Your know as a chinese ,my english is very pool. If you guys don't know what i say, welcome to send me a mail. Athurg Gooth now
On Mon 30 Nov 2009 17:27 +0800, Athurg Gooth wrote:
When i port a chinese version AUR, I fount this bug. That once i setting a default language to sth(eg: zh_CN) by change DEFAULT_LANG macr define in web/lib/config.inc, it won't work, and this language page(here is zh_CN) could not show its native strings.
DEFAULT_LANG was supposed to indicate the language that strings in the code are written in, so that if someone asked for 'en' then the code wouldn't look for en.po and come up with an error. I think your idea makes more sense though.
Then i turn back to check if i got a wrong spelling. But i fount the developer have told us that options couldn't be change(in web/lib/config.inc, line 48). So I think maybe its a bug which havn't been fixed.
After i check all the code about language setting, i think i got the reason. We have two problems which cause that bug.
First, in .../web/lib/aur.inc, between line 296 to line 298. Even the $LANG==DEFAULT_LANG, we should include the $LANG.po file. Because once the DEFAULT_LANG isn't english, we also need translate the strings. So i just suggest add an 'else' branch after line 298 to include DEFAULT_LANG.po.such as"else{include_once(DEFAULT_LANG.".po";)}"
Second, in .../web/lib/translator.inc, between line 52 to line 62. The reason is as the same as i said above. If we havn't set a $LANG var, the $LANG will be set to DEFAULT_LANG. But the DEFAULT_LANG doesn't mean english. Even the $LANG havn't been set, the $_t maybe setting (see Firest above) when include from DEFAULT_LANG.po. We should also translate them. So i think we should remove the 'else' identify. make the 'else' branch work for ever.
By the way if the function "include_lang()" in .../web/lib/translator.inc, between line 32 to line 40 is an old function to make the lang func? Maybe we should remove them.
Indeed. I think we can remove it now.
I prepare to make a mirror for our AUR to chinese people, how could i got the databases an files from aur.archlinux.org. OR i couldn't make a mirror for that.
It's great to hear that people are playing with the AUR code. Thanks for the patch. I've applied a slightly modified version. It has helped reveal some redundant code that we could eliminate too. Please let us know more about your ideas about mirroring the AUR. Thanks and cheers! Sorry about the delay.
participants (2)
-
Athurg Gooth
-
Loui Chang