Internationalization- name of mo files Windows / Linux Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
TobiasA
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Aug 28, 2017 8:42 am

Internationalization- name of mo files Windows / Linux

Post by TobiasA » Sun Nov 18, 2018 12:22 pm

Hi,

I have an application that is available in English US (EN_US) and german (DE_DE).
Languagefiles are stored in <exe directory>\de_de\appname.mo and en_us\appname.mo.
Under windows, this works. Under Linux, it does not- seems it can't find the file even if it is placed in the same directory as under windows, same name.
Is there any special requirement under linux, like requiring en_us somewhere in the name of the mo file or a specific path for it?

Thanks in advance everyone.

DavidHart
Site Admin
Site Admin
Posts: 3820
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Internationalization- name of mo files Windows / Linux

Post by DavidHart » Sun Nov 18, 2018 1:50 pm

Hi,

1) Generic answer: look at the relevant wx sample ('internat' in this case) and see what you do that's different ;) .

2) More specifically, a Linux program expects to find its locale files under /usr/share/locale/ so if yours are somewhere different, you may need to announce this with wxLocale::AddCatalogLookupPathPrefix before your AddCatalog() calls.

Regards,

David

TobiasA
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Aug 28, 2017 8:42 am

Re: Internationalization- name of mo files Windows / Linux

Post by TobiasA » Sun Nov 18, 2018 2:59 pm

Strange thing is that I did add the catalog path #-o
I could not find any difference given both the sample and the exact same (working) code under windows :?

So the name of the file itself doesn't play any role as well as where the file is placed (as long as it gets added via wxLocale::AddCatalogLookupPathPrefix of course)?

If yes, I guess I'll have a coworker looking on some weird typos or something...

TobiasA
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Aug 28, 2017 8:42 am

Re: Internationalization- name of mo files Windows / Linux

Post by TobiasA » Sun Nov 18, 2018 3:55 pm

Well, guess the reason was simply using "en" instead of "en_us" for wxLANGUAGE_ENGLISH_US. I don't know if this is correct, but... Hey, it works.
Will have to use different directories for windows and linux tho since windows will accept en_us.
The question remains how one is able to sort out between english UK and english US, but I think this won't matter this much in reality since rarely ever someone provides both options.

DavidHart
Site Admin
Site Admin
Posts: 3820
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Internationalization- name of mo files Windows / Linux

Post by DavidHart » Sun Nov 18, 2018 4:30 pm

Well, guess the reason was simply using "en" instead of "en_us" for wxLANGUAGE_ENGLISH_US
Linux is case-sensitive, so that probably should be en_US (or en_US.utf8 or...)

TobiasA
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Aug 28, 2017 8:42 am

Re: Internationalization- name of mo files Windows / Linux

Post by TobiasA » Sun Nov 18, 2018 7:41 pm

That might be worth a try. However, using "en" with "en_us" works too... Will try en_US too. Thanks for the hint!

DavidHart
Site Admin
Site Admin
Posts: 3820
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Internationalization- name of mo files Windows / Linux

Post by DavidHart » Sun Nov 18, 2018 8:32 pm

I should have mentioned: doing in a terminal
locale -a
will tell you what locales are installed on your system.

Post Reply