Translations -- use GNU GetText please

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Jhong
Registered User
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

Translations -- use GNU GetText please

Post by Jhong »

I did a search and didn't find anything recent relating to the phpBB translation process.

As a mod author, I find the translation system really grating:
- I have to keep track of constants across multiple files.
- As translations go out of date, the templates fall back to showing constants rather than the English equivalent.
- There are no good third-party tools for the phpBB translation system; why should translators have to learn PHP array syntax (however simple it may be?)

Not sure if Symfony will provide an in-built translation system, but I'd like to voice my support for the (pretty much industry-standard) gettext.

- As a developer, simply __('enclosing my strings like this') is easy and painless.
- For translators, they can use a multitude of tools to help them with the translation, including online tools like launchpad.net.
- When translated strings are missing, the original string is shown.
- The distribution and activation of language packs / files is effectively the same as it is now

I'd love to see this change.

J

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: Translations -- use GNU GetText please

Post by Oleg »

I am working with gettext in another project which is currently in early stages of development.

Gettext has many features, no doubt due to its maturity and wide user base. One feature in particular that most "roll my own" internationalization frameworks do not offer is proper support for inflections. There are facilities for specifying the number of inflection forms each language supports, the formula for figuring out which form should be used given a number/quantity, all in a concise format.

I cannot yet endorse gettext entirely simply because I have not used it enough, but I agree that it is a good option to consider.

In terms of practically using it I would be most concerned with its penetration among hosting providers. Since somewhere between many and most phpbb users do not administer their servers relying on an extension which is not widely available probably will not be acceptable.

How about this note from http://www.php.net/manual/en/gettext.requirements.php:
The GNU gettext library works on a per-process, not per-thread basis. This means that in a multi-user setting such as the Apache web server it will only work with a prefork MPM (i.e. one process per user). Worker and other threaded MPMs will not work.
Or user notes on http://www.php.net/manual/en/ref.gettext.php.

Php's execution model once again demonstrates a poor fit with large projects.

Jhong
Registered User
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

Re: Translations -- use GNU GetText please

Post by Jhong »

there are php classes/libraries you can use for gettext if gettext isn't compiled into PHP itself. I think that's how WordPress does it.

RonnyO
Registered User
Posts: 1
Joined: Mon Nov 15, 2010 8:52 pm
Contact:

Re: Translations -- use GNU GetText please

Post by RonnyO »

String looks promising, we'd like to test it soon for managing the Hebrew language pack. Any other translators here want to give it a try?

We do need to remember l10n is more than strings - Think calendars, RTL, typography, graphics etc.
But maybe String can do the job... at least for strings.

User avatar
Kudlaty
Registered User
Posts: 4
Joined: Fri Oct 22, 2010 7:31 am

Re: Translations -- use GNU GetText please

Post by Kudlaty »

symfony already use gettext :)

DrAcid
Registered User
Posts: 5
Joined: Thu Jun 09, 2011 5:03 am

Re: Translations -- use GNU GetText please

Post by DrAcid »

:idea:
Yes! Please, use gettext! it is amazingly useful and working with it is a breeze!
You can actually setup the translation process over web as well as offline!

I'm sorry but the translation process is a pain right now. especially making changes to lang files as new versions come out... :arrow:

And it works even better than just keeping strings in an array in a .php file :)

number3nl
Registered User
Posts: 6
Joined: Sun Mar 07, 2010 12:38 am

Re: Translations -- use GNU GetText please

Post by number3nl »

+1 for this proposal!!!

As a MOD translator (ea. Anti-SPAM ACP, Download MOD [from phpBB2.x onward from time to time]) I find that phpBB is a hard to translate, not because of language ofcourse. I have been working with phpBB for over 5 years now, and from time to time I have to upgrade. The reason why I fear upgrade with phpBB, they will always give me work. Work as a PHP hacker and work in my translations. MODs are even worse in that regard, since most MOD authors don't think about the translations at all.

I have been working with wordpress for over 2 years now, and I have to say it's a breeze maintaining both code and translations.

With Wordpress they use GNUtext, it seperates the "language" from the coding. No longer I work in "PHP code" files I have to hunt down in places in the code tree of the program. I just use POedit, I scan the plugin directory (yes, more room for improvement for phpBB, all code of a plugin is located in a single directory!.

This means that I can focus on a correct translation, but putting a translation file into the language directory the translation is done. Without touching php code, meaning I cannot break the plugin (mod) or software I work on.

So pro's for a translator:
1. Work on translating, instead of PHP code. Code and Text are seperates resources.
2. Do'nt worry about "coding" your translation into PHP correctly (if you do make mistakes now it breaks the code, and is hard to find).
3. No hunting for php files with "text" that need translation, POedit helps you there, it finds text.

One improvement for MODs would be that they stay in a single directory. Instead of having a single "language" directory, every MOD should have it's own language. Now I know this might give some performance issue, but I would improve on more then just translation. I mean having to hunt for phpBB code, to find the code that belongs, to "patch" instead of "plugin". I noticed that there is a lot of talk on moving toward a more plugable codebase. DO THAT!

I also coded on a plugin that connects phpBB3 and wordpress, in the form of a widget (recent_posts_phpBB3). From that I learned that its simple to implement for a developer, so simple its hard to agrue not using it :D

Pro's for developer:
1. Easy of implementation, it's adding some simple libs and statements to your code, but not intrusive. No lookup's in the code, you code like you normally do.
2. Seperate the code from the text, making it simple for the translators.
3. More translations can be added, simply by adding the translation files.

O, right, and all the talk on performance. I have seen wordpress on large sites, it works. It performs. Lets look at other projects, like wordpress how they use GNUtext...

Please add GNUtext to a future release, its good for the phpBB ecosystem. Its good coding practice, and, it will give more people the possibility to giveback doing translations.

Qiaeru
Registered User
Posts: 32
Joined: Thu Jul 07, 2005 7:45 am
Location: Paris, France
Contact:

Re: Translations -- use GNU GetText please

Post by Qiaeru »

Definitively a good system, a +1 from me!

igorw
Registered User
Posts: 500
Joined: Thu Jan 04, 2007 11:47 pm

Re: Translations -- use GNU GetText please

Post by igorw »

Kudlaty wrote:symfony already use gettext :)
I'm not sure what symfony1 does, but Symfony2 does not use gettext. It has a custom parser for the XLIFF format. There are however tools to convert between PO and xliff.

One of the things I don't like about these is that you no longer have a 'language key' for translation. This means your 'key' is the sentence itself, and if it ever changes, you have to change it in ALL language files. Correct? How do others deal with this?

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Translations -- use GNU GetText please

Post by callumacrae »

igorw wrote:
Kudlaty wrote:symfony already use gettext :)
I'm not sure what symfony1 does, but Symfony2 does not use gettext. It has a custom parser for the XLIFF format. There are however tools to convert between PO and xliff.

One of the things I don't like about these is that you no longer have a 'language key' for translation. This means your 'key' is the sentence itself, and if it ever changes, you have to change it in ALL language files. Correct? How do others deal with this?
That doesn't sound very backwards compatoble :?

I also don't like "__" as a function name.

~Callum
Made by developers, for developers!
My blog

Post Reply