Announcement

  •  » Translations
  •  » Improve localization and internationalization

#31 2010-03-03 12:24:48

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Improve localization and internationalization

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

 

#32 2010-03-03 13:43:27

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Improve localization and internationalization

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.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#33 2010-03-03 14:36:33

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Improve localization and internationalization

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

 

#34 2010-03-03 14:51:29

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Improve localization and internationalization

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?


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#35 2010-03-03 15:23:11

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Improve localization and internationalization

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

 

#36 2010-03-03 17:03:24

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Improve localization and internationalization

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. ;-)


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#37 2010-03-03 20:30:33

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Improve localization and internationalization

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

 

#38 2010-03-03 23:14:16

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Improve localization and internationalization

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, ...)
   

Code:

msgmerge -v -U language/LANGUAGE_CODE/LC_MESSAGES/messages.po language/templates/messages.pot

If it's a new language, the command is :

Code:

    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 :

Code:

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 :

Code:

msgfmt language/LANGUAGE_CODE/LC_MESSAGES/messages.po -o language/LANGUAGE_CODE/LC_MESSAGES/messages.mo

Enjoy.

Offline

 

#39 2010-03-03 23:42:00

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Improve localization and internationalization

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.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#40 2010-03-03 23:53:26

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Improve localization and internationalization

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

 

#41 2010-03-04 00:15:37

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Improve localization and internationalization

[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.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#42 2010-03-04 00:22:42

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Improve localization and internationalization

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

 

#43 2010-03-04 07:38:39

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: Improve localization and internationalization

Yes! ;-)
With template modelling in place that would reduce the impact but we have to find the simpliest way.


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#44 2010-03-11 14:11:05

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: Improve localization and internationalization

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

 

#45 2010-03-15 21:49:21

nicolas
Former Piwigo Team
2004-12-30
1232

Re: Improve localization and internationalization

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

 
  •  » Translations
  •  » Improve localization and internationalization

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact