Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting up new language
04-03-2013, 01:15 AM,
#1
Setting up new language
I am trying to set up new language(s) for use with the gettext() calls. These are not "real" languages, but rather customised variations to cater for the
jargon used in different types of business for the same thing. Have done a quick test, editing an existing .po file, then running "msgfmt -o messages.mo messages.po" to check I understand this part of the operation, then I created a new "en_XX/LC_MESSAGES" directory, copied messages.po there and compiled it. I also added a new stanza to LanguagesArray.php and checked I can change the user language; however it seems to ignore the new .mo file.

Is what I am trying to do feasible, and if so, where I am I going wrong?
Reply
04-03-2013, 05:38 AM,
#2
RE: Setting up new language
I think this should be possible. Although there should be a fall back to the phpgettext library - the server should also have the locale installed for the language that you have selected. You can make up a locale for any made up language in linux using he locale tools - I can't recall the syntax but google will help!
Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Reply
04-03-2013, 07:30 PM,
#3
RE: Setting up new language
Thanks for that. Yes, it does appear that the language needs to be defined at the operating system level (/usr/share/locale) even if the translation strings actually come from the WebERP files. I "borrowed" en_NZ from /usr/share/locale, which did not already have a matching WebERP directory, and once I had created the WebERP directory the text translation worked. So it looks like I just need to work out how to add a new language at the operating system level and I can then do it properly.
Reply
04-03-2013, 10:44 PM,
#4
RE: Setting up new language
You may also have to restart Apache after making any changes - I found this after a very frustrating couple of hours!!
Reply
04-04-2013, 12:44 AM,
#5
RE: Setting up new language
So now I am back to creating a new linux locale, at which point I am stuck. I have seen the command locale-gen mentioned, but this does not seem to be available for Centos (and we are fairly strict on installing only packaged software on the server). Does localedef do the same thing, and does anyone know what the arguments would be? I presume I just need effectively a copy of the en_GB.utf8 locale.
Reply
04-04-2013, 01:51 AM, (This post was last modified: 04-04-2013, 06:58 AM by phil.)
#6
RE: Setting up new language
(04-04-2013, 12:44 AM)tomglare Wrote: So now I am back to creating a new linux locale, at which point I am stuck. I have seen the command locale-gen mentioned, but this does not seem to be available for Centos (and we are fairly strict on installing only packaged software on the server). Does localedef do the same thing, and does anyone know what the arguments would be? I presume I just need effectively a copy of the en_GB.utf8 locale.

There is a good example here of an en_XX locale:

http://xyne.archlinux.ca/projects/locale...en_xxposix

Its not very clear where the code is to be found, but it's here:

http://xyne.archlinux.ca/projects/locale-en_xx/src/

Hope this helps
Tim
Reply
04-04-2013, 11:20 PM,
#7
RE: Setting up new language
Finally cracked it!! The documentation on localedef is woefully inconsistent, and the location of the relevant directories is very confusing (charmaps live in one place, the charset-independent locale definitions in another, and the binary files, resulting from compiling the above two, live in a third. Plus, depending on the syntax you use, you can end up with either a single archive containing all the locales, or several separate files for each locale. And the usr/share/locale directory is nothing to do this process - instead it is a repository for application-specific translation files).

Anyway, much hair-tearing later, it transpires that all you need (on Centos at least) is the command :

localedef -cvi en_GB -f UTF-8 en_YL.utf8

to create a customised locale which matches the en_YL.utf8 locale set up in the webERP system. It all now works!!
Reply
04-05-2013, 08:29 AM,
#8
RE: Setting up new language
Great stuff ... I had looked at the man page for localedef but looked too cryptic for me - glad you worked it out! I can use this for testing locales too that I don't have installed - my little puppy linux distro doesn't come with all conceivable locales preinstalled.
Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Reply
11-18-2013, 05:51 PM,
#9
RE: Setting up new language
when I try to select another language like German it still show English.

I checked in the webERP/locale/de_DE.utf8/LC_MESSAGES German language is there.
But when I checked in weberp/languages only english is there.

How can i ADD IT ?
Reply
11-18-2013, 05:57 PM,
#10
RE: Setting up new language
where is weberp/languages?

You click on your user name and select the language from the list. If the list of languages does not display there is something wrong with your installation
Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)