-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Going multilingual #18
Comments
Right. |
In my experience translations on launchpad are a pain to deal with (no easy access to final .po/.pot files, slow interface). Maybe you should give transifex a try. Here is a project I use to work on, just register and see for yourself if it fits your needs. A self-hosted alternative would be weblate |
I've also searched for my scripts how I can use .po/.mo files but as I wanted to keep a single file for the end user it was difficult to "compile" it. I found this to convert .po file into binary .mo file in php which can be helpful : For now, I think I will use simple arrays as explained here which seems to be the simplest for my needs : |
Please, please, don't reinvent the wheel and use some kind of array system. This will prevent you from using translation tools such as Transifex or Launchpad, which will make life more difficult for your translators (most of which are not necessary developers). Using standard formats (such as gettext's .po) makes is easier for non-developers to contribute. I collaborate on both Transifex and Launchpad. Transifex is more user friendly, but one nice feature from Launchpad is that translations from other projects are also available, which makes it faster to translate common senteces words. Although I'm not a huge fan of Launchpad, I want to infirm what nodiscc mentioned: exporting .po and .pot files is absolutely possible, you click one link, and 2 minutes later you have a tarball in your email with everything you need. This help page explains the process: https://help.launchpad.net/Translations/YourProject/Exports#Requesting_a_one-off_download I sent a patch in September 2011 (based on Shaarli 0.0.9 beta!) that added gettext support (and translated just one string). I assume the patch won't apply cleanly on version 40, but the principle hasn't changed. My patch came with a rather long email, so I'll put that in a separate post below. Hope this can be helpful! |
Sorry for the mail in French, code below. date: 19 septembre 2011 20:17 Salut Seb, J'ai déjà posté un commentaire sur la page de Shaarli sur ton wiki [0] La raison pour laquelle je t'envoie ce mail est pour te demander ton
Si tu veux utiliser GNU Gettext, ca donnerai un layout des fichiers comme ca: ./index.php Donc pour resumer, à côté du script index.php il y aurait un dossier Dans ton repository (le code source), seuls les fichiers .pot et .po Cette approche voudrait donc dire que tes utilisateurs devront Pour te donner une idée, je te joins un zip avec mes modifications. Ouvres le fichier ./i18n/fr.po, traduis les strings. Une fois fini la Recharge la page, et tu verras ton nouveau string traduit! Si tu decides d'aller avec Gettext, si tu veux je pourrais te Mais bon, je ne veux pas aller trop loin, au cas ou tu ne voudrais pas Bon allez, ce mail est deja mille fois trop long! Dis moi ce que tu en penses. P.S.: Tu m'excuseras, mais j'en avais plein le cul de corriger les [0] http://sebsauvage.net/wiki/doku.php?id=php:shaarli#comment_e0f627dfc9884f4a264b2ebcaf50c8d3 Unfortunately I can't attach my patch and tarball with translation, so I've pasted it below: EDIT: pasting the patch file didn't look good...
|
Pour la traduction, je me suis développé un petit module (vue son importance, il n'a pas encore de dépôt. il est utilisé ici par exemple https://github.com/Leomaradan/URLess) une class i18n, avec une fonction getText, et un fichier .ini par langue / région. ça gère les langue type IETF, par exemple fr-CH pour le suisse romand. Si le fichier fr-ch.ini n'existe pas (le code de langue, mais en minuscule), ça chercher le fichier fr.ini. Enfin, si fr.ini n'est pas trouvé, ça utilisera une langue par défaut, à configurer (et si le fichier de langue n'existe pas... ben tant-pis :p) L'avantage du .ini, c'est la facilitée de manipulation. Il est possible de donner le fichier à traduire même à des non-codeurs, pas besoin d'outil spécifique pour le générer, etc A voir, mais ça me semble une solution relativement simple à utiliser, qui pourrait aller dans la veine de Shaarli |
This is exactly what I mean by reinventing the wheel... Existing standards have been pounded upon by a large number of people much smarter than we are ;) Just as an example: does this .ini solution handles for instance plurals? ("Il y a un lien avec le tag blabla" versus "Il y a 5 liens avec le tag blabla") Also, if you use an online platform for translation, your non-coders don't even need to download a file, find it on their machine, edit it, send it again via email, etc. With an online platform you're opening yourself to "drive-by" contributions, one of the strengths of open development... Using standard/existing tools is the same reason why Shaarli is using a templating engine, PHP's session/cookie handling, etc. Of course, everything could be written from scratch, but then you have to fish out the bugs, maintain the code in the long run, etc. |
IMO, online platform is a bad idea, it makes Shaarli dependent of external tools. Actually, Shaarli has few codes, with only vital/simple feature - And it's why it is good. For example, the template system, RainTPL is simple, not as complete than Smarty (for example), but makes his work. A complexe i18n system is needed ? or a basic solution, with literal translation, can be used ? My .ini solution provide only direct translation (also with variables), but can be sufficient. (for your example, use parentheses is possible: "Il y a X lien(s) avec le tag blabla" ;) ) |
An online tool is just an extra, easier-to-use platform, not a dependency. Look at my patch a few posts up: the first few lines are language detection (which you'd have to do as well with .ini), and the real "framework" code is just 3 lines:
Then you wrap your strings with |
Just to make sure we're all on the same page when discussing .po vs .ini, here is an extract of an actual .po file:
Hopefully this makes it clear that .po files are also editable in a normal text editor, for contributors that would not want to use online services. For those that want, this allows for direct import in any number of online editors. |
RainTPL 3 implements a basic internationalization system, with dictionary. http://www.raintpl.com/Forum/Development-Forum/Rain-TPL-3/?t=139 |
The https://github.com/shaarli/Shaarli community fork will likely use gettext as an internationalization/localization system. @Leomaradan The current Shaarli codebase doesn't work against RainTPL 3 unfortunately; Pull Request welcome! |
I guess the procedure would be:
I don't have any favorite method to maintain a software translations in many languages, so I have none to suggest here, but at least it's on the list.
The text was updated successfully, but these errors were encountered: