VDigital wrote:
Sorry, I didn't read the whole topic.
More than local.lang.php (I agree), I have questions about templates...
1 - New templates with additionnal texts, eg. I hide some option in profile and I change Personalization to "Language selection" in quick connect
How should I manage its translation?
Or I added text in the About / Search / Comments page and how should I manage these translations?
2 - template-extension I added a template-extension for footer.tpl with a warning message, how should I manage its translation?
I don't really understand what you mean ? How do proceed now (before my commit) ?
Offline
I managed additional keywords translation by theme (Juza theme (no longer maintained) had an example of this management).
http://piwigo.org/code/wsvn/Piwigo/exte … nf.inc.php
Just a load_language('lang', JUZA_PATH);
For template-extension, because it is really local, I used local.lang.php
Now with gettext, could you tell me the best way to manage these cases? (If you already have an idea).
I am going by 2.1 to produce a new template (similar to Juza theme but as a template),
and I will be facing this case.
Offline
I didn't start thinking about the right way to manage translation for plugins. Of course a good, we will use gettext but I didn't implement the solution. Stay tunned !
Offline
I have no real problem with Plugins they will use their own .mo files in their tree.
(Like PiwigoPress did it).
The problem is with templates.
Smarty has a addon for gettext support.
But out of "how collecting keys?" the real questions are:
Where should we save .po and .mo files for templates and template-extensions?
When should we produce them?
Where/How we should publish .po and .mo in extensions?
Offline
VDigital wrote:
I have no real problem with Plugins they will use their own .mo files in their tree.
(Like PiwigoPress did it).
Ok
VDigital wrote:
The problem is with templates.
Smarty has a addon for gettext support.
But out of "how collecting keys?" the real questions are:
Where should we save .po and .mo files for templates and template-extensions?
When should we produce them?
Where/How we should publish .po and .mo in extensions?
I don't use smarty gettext plugin and templates still use @translate function !
What is the difference between before my commit and after it ? How would you have managed that before my commit ?
Offline
2 minutes to reproduce the issue.
Make a temporary template:
1 - Copy yoga as nico in ./template
2 - Adapt nico/theme/clear/themeconf.inc.php
Select nico/clear as your template/theme.
Tell me what you get in @translate results with nico/clear?
[ I will implement template modelling feature asap
so many missing translation cases will be automatically solved but not all.
It will reduce size of .po and .mo file as well. ]
Note: I didn't want to have an additional dependancy with the smarty gettext plugin. ;-)
Offline
I really don't understand what you try to explain.
If I just copy yoga to nico template, the result will be exacly the same. It was the case with old localization system and with the new too.
Offline
Some help to start with gettext :
1) when you want to add a new key to be translated, add it to language/templates/messages.pot.
2) update each language/LANGUAGE_CODE/LC_MESSAGES/messages.po (replace LANGUAGE_CODE by correct language code, fr_FR, es_ES, ...)
msgmerge -v -U language/LANGUAGE_CODE/LC_MESSAGES/messages.po language/templates/messages.pot
If it's a new language, the command is :
msgmerge -v language/LANGUAGE_CODE/LC_MESSAGES/messages.po language/templates/messages.pot -o language/LANGUAGE_CODE/LC_MESSAGES/messages.po
You must have a message like that :
Read 1 old + 1 reference, merged 881, fuzzied 1, missing 2, obsolete 0.
It depends of what you really added. I added on string and it tries to translate it itself (fuzzy)
3) Translate the new strings. You must now compile the messages.po into a messages.mo that can be used by PHP :
msgfmt language/LANGUAGE_CODE/LC_MESSAGES/messages.po -o language/LANGUAGE_CODE/LC_MESSAGES/messages.mo
Enjoy.
Offline
nicolas wrote:
1) when you want to add a new key to be translated, add it to language/templates/messages.pot.
Yes, I know this point.
Now, think you are not a Piwigo team member but just a webmaster and you want to create your template
and maybe provide a style extension... a zip to transfer in ./template/ directory and now I have to add a key in language/templates/messages.pot. Try to make the zip file you will understand my problem.
I have no idea on the way to provide a solution.
Offline
VDigital wrote:
I have no idea on the way to provide a solution.
And I repeat my question : how would you have done the job before my commit with the old system ?
Offline
[Forum, post 112149 by VDigital in topic 15739] Improve localization and internationalization
I will try to call you tomorrow but I have a really full booked day on tomorrow.
Offline
VDigital wrote:
[Forum, post 112149 by VDigital in topic 15739] Improve localization and internationalization
I will try to call you tomorrow but I have a really full booked day on tomorrow.
Me too. It's my last day before vacations and I have many things to do!
I understand now what you do and it's very ugly ! It's not the right place to do that. I admit it's a hack but I think we must find a proper way to do such kind of things !
Offline
Yes! ;-)
With template modelling in place that would reduce the impact but we have to find the simpliest way.
Offline
P@t told me that gettext was hugely slowing down Piwigo. The page are generated in 1.5 second (instead of less than 0.1 second). As soon as he update to a revision prior to gettext ([Subversion] r5022), page generating time goes back to normal.
Offline
After private discussion with plg, we decided it will be better to postpone internationalization with gettext. We will use gettext only for piwigo 2.2.
But we can test today because we create a special branch (an experimental one) which use gettext :
http://piwigo.org/code/wsvn/Piwigo/bran … s_gettext_
Any kind of test or ideas to improve that branch are welcome
Offline