asb / raspi-config

Configuration tool for the Raspberry Pi. Now maintained at https://github.com/RPi-Distro/raspi-config
Other
264 stars 332 forks source link

Adding support for more languages #5

Open gyeben opened 12 years ago

gyeben commented 12 years ago

Hi!

Since Raspbian is available in a lot of languages I think it would be nice if raspi-config could be multi-language, too. Translation could have been done by the community of Raspberry Pi users.

Users could run raspi-config in another language (than English) by typing raspi-config --lang=XX, where XX would stay for the language code for a language - or raspi-config could include a screen where a user can select a language.

williamhbell commented 12 years ago

It would be good to be able to change the default language and set of default keyboard options too, in a custom build image. Such images would be very useful for the French school system.

Regards, Will

gyeben commented 12 years ago

OK, so noone cares about implementing this, right?

Jamstah commented 12 years ago

NLS of bash scripts isn't easy, but it is possible.

It would need someone to do the initial work to make the script translatable, there is a good tutorial here: http://mywiki.wooledge.org/BashFAQ/098

Do you fancy giving it a go?

After you have the .po files, getting them into the debian package should be easy.

asb commented 12 years ago

I would love to accept a patch implementing this functionality, or indeed any improvements for multi-language support in general for the Foundation's image.

mircea-vutcovici commented 12 years ago

I have started to do the i18n. I will also do the l10n for Romanian.

gyeben commented 12 years ago

Ok, so I will try to make the script translateable.

asb: are there any other RasPi-specific applications in the Foundation's image?

asb commented 12 years ago

There's the /opt/vc/bin stuff, but that's not currently open source. Otherwise, I think that's it. I suppose someone might be interested in internationalising omxplayer

gyeben commented 12 years ago

I might give up. Following the tutorial linked by Jamstah (mywiki.wooledge.org/BashFAQ/098), I just can't do it. I could generate pot, po and then mo files, and modified raspi-config, but it still doesn't use the locale files.

Jamstah commented 12 years ago

Did you put the files in the right places? Did you run "dpkg-reconfigure locales" to generate the locale you're testing?

If you know how to make a branch on github, you could do that, then we can look at your code.

Jamstah commented 12 years ago

Having just had a check myself, if you see a $ in front of all the string when you use the tool, its because you need to change #!/bin/sh at the top to #!/bin/bash, otherwise the shell won't use all the bash features, including localization.

You know its working if you add the $'s, and the text looks normal in english.

mircea-vutcovici commented 12 years ago

Take a look in to my branch. It is almost ready, but it is not fully tested.

gyeben commented 12 years ago

Jamstah: thanks for pointing this out.

mircea-vutcovici: just modified it a bit, see my branch.

gyeben commented 12 years ago

OK, so far I posted a new thread in the Raspbian topic on the forum: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=66&t=16864

Jamstah commented 12 years ago

Couple of things from a quick look:

MEMSPLIT_LIST_DESCRIPTION=$SPLIT$"MiB for ARM, "$SPLIT$"MiB for VideoCore" could be (and it looks like there's a bug in the line too - same MiB for ARM and Video): MEMSPLIT_LIST_DESCRIPTION=$( printf $"%sMiB for ARM, %sMiB for VideoCore" ${CURRENT_MEMSPLIT} $((256 - $CURRENT_MEMSPLIT)) ) It just means that if the number doesn't come at the start of the line in the second language, the translator can move it.

Jamstah commented 12 years ago

Also, if you add "./locale/hu/LC_MESSAGES/raspi-config.mo /usr/share/locale/hu/LC_MESSAGES/" to the debian/raspi-config.install file, you should be able to run "dpkg-buildpackage" in the folder, and build a debian package that contains the translations.

You don't need the en translations, that will be the fallback translation anyway.

mircea-vutcovici commented 12 years ago

Thank you! I will change the stuff to include your suggestions. You can see the work in progress in my branch. It is not finished yet, but at least it works fine.

Jamstah commented 12 years ago

You two should really get together and choose one of your branches to concentrate on, otherwise you will end up with two slightly different sets of strings to translate, which won't really help :)

gyeben commented 12 years ago

mircea-vutcovici: I'm pretty sure that you need .mo files instead of .po (they're pretty much similar, .mo is kind of a compiled .po file). Also, the .mo files should be all called raspi-config.mo when the program is installed. The structure for language files should be (when installed): /usr/share/locale/langcode/LC_MESSAGES/raspi-config.mo eg.: /usr/share/locale/ro/LC_MESSAGES/raspi-config.mo

I have deleted my branch because I saw that you had more bugfixes. But then I had to make a new branch, because github allows me only to work on branches that I forked for myself. :) Anyway, before Friday I'll try to finish and test the Hungarian translation and then I'll make a pull request.

Jamstah commented 12 years ago

It was more that I thought your po files should match up, so you could share translation efforts when its ready to go, so a new branch from the same english source is a good idea.

You don't need mo files in the package, you could add a build step to generate the mo from the po at build time.

mircea-vutcovici commented 12 years ago

The .pot file is the template. The .mo are binary files and should not be in the source control. Only the .po and the .pot. The .mo files should be part of the .deb package.

gyeben commented 12 years ago

Sorry - I didn't know that.

mircea-vutcovici commented 12 years ago

I've added a doc for translations, it is the README fiel in the po folder. If you are ready I can integrate other translation into my tree. Next on my list is to update the package specifications.

Jamstah commented 11 years ago

Just an FYI here - recent updates to raspi-config have added more translatable strings. One of the perils of NLS.

gyeben commented 11 years ago

Well, as I can see, there have been several commits which cause the localization not to work, so I'm going to redo this whole thing.