CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • Compilation of .po files
Pages: [1] 2

Author Topic: Compilation of .po files  (Read 14826 times)

korell

  • Guest
Compilation of .po files
January 28, 2008, 02:40:27 am
Hi!

I have a drupal-site with the civicrm-module.

I want to use a norwegian translation for civicrm. I have downloaded the .po-files and the gettext-tools for windows. My problem is this: How do I (in windows) compile all the .po-files into one .mo-file? I have tried several ways that don't work so far:
"type *.po > | msgfmt -vo civicrm.mo -" - lots of errors.

Can I compile each file seperatly and somehow import the strings to civicrm to make it work?

Also, can I replace the content of the provinces-file to include only norwegian states and cities? Will this override existing provinces or will they just be an addition that is visible using this setting:

define( 'CIVICRM_COUNTRY_LIMIT' , 'NO' );
define( 'CIVICRM_PROVINCE_LIMIT' , 'NO' );
define( 'CIVICRM_DEFAULT_CONTACT_COUNTRY', 'NO' );

Please help with this so I can get my site running with civicrm... :)


Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Compilation of .po files
January 28, 2008, 03:46:58 am
If you’re using our ‘official’ translation, then the MO file is already compiled – get the civicrm-*-i10n.tar.gz file for your release and you’ll find all the MO files there.

If you’re using your own translation, please consider contributing it – we’ll maintain the MO files for you. :)

Finally, msgfmt can take multiple files as its parameters, so you could try `msgfmt -vo civicrm.mo *.po` – the catch is, we have multiple definitions of some strings, and msgfmt doesn’t like this, hence our use of msgcat: `msgcat *.po | msgfmt -vo civicrm.mo -` (your type approach won’t work here).

Note: I don’t know how one does output redirection in Windows’ shell, but it’s either with > or |, not both. :)
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

korell

  • Guest
Re: Compilation of .po files
January 28, 2008, 04:22:32 am
I have already downladed the i10n-file. There is no official translation in Norwegian, so I need some help to make it work..  If I can make it work, I will distribute the work I've done.

You're right. There was an error in the command-line, but I just cannot make it work.

When I try the original commane line (the one you gave me) I get this error:

Error opening *.po for reading. Invalid argument.
0 translated strings

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Compilation of .po files
January 28, 2008, 06:04:42 am
Quote from: korell on January 28, 2008, 04:22:32 am
I have already downladed the i10n-file. There is no official translation in Norwegian, so I need some help to make it work..

Well, I remember seeding it, and yep, it’s right there. There doesn’t seem to be any work done on it, though. :)

You can also get the MO file straight from our code repository.

Quote from: korell on January 28, 2008, 04:22:32 am
If I can make it work, I will distribute the work I've done.

Thanks, most appreciated!

Quote from: korell on January 28, 2008, 04:22:32 am
When I try the original commane line (the one you gave me) I get this error:

Error opening *.po for reading. Invalid argument.
0 translated strings

Do you do this from inside the directory where you have the PO files? (It says there aren’t any PO files in where you try to run this command from.)
« Last Edit: January 28, 2008, 06:11:02 am by Piotr Szotkowski »
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

korell

  • Guest
Re: Compilation of .po files
January 28, 2008, 06:36:56 am
Thank you very much for your replies.

What I meant was that the norwegian version is not in the distributed version (in the civicrm-1.9.12432-l10n.tar.gz) as a .mo-file. I have found the norwegian files and have continued working on them.

I was running the command from within the directory with the .po-files. I tried various ways of running the command-line but all ended with various errors. No luck so far.


Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Compilation of .po files
January 28, 2008, 07:01:12 am
Quote from: korell on January 28, 2008, 06:36:56 am
What I meant was that the Norwegian version is not in the distributed version (in the civicrm-1.9.12432-l10n.tar.gz) as a .mo-file. I have found the Norwegian files and have continued working on them.

Hm, interesting. Every time I check it’s right there:

Code: [Select]
shot@devielle:~$ tar -tf civicrm-1.9.12432-l10n.tar.gz | grep no_NO
civicrm/l10n/no_NO/
civicrm/l10n/no_NO/LC_MESSAGES/
civicrm/l10n/no_NO/LC_MESSAGES/civicrm.mo

Quote from: korell on January 28, 2008, 06:36:56 am
I was running the command from within the directory with the .po-files. I tried various ways of running the command-line but all ended with various errors. No luck so far.

This is very strange. What does dir show, and what does dir *.po show?
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

korell

  • Guest
Re: Compilation of .po files
January 28, 2008, 09:50:00 am
Don't know what was wrong, but when I downloaded the file again the norwegian file was there.. Maybe I dl'ed the wrong file last time.

Now I only need to know how to compile them. This is how I did it:
I copied the .po files to my c:\gettext-tools directory. Then I made a .bat file with the following command:

bin\msgcat *.po | bin\msgfmt -vo civicrm.mo -

(the bin-directory is not in path)

korell

  • Guest
Re: Compilation of .po files
January 28, 2008, 10:31:10 am
Can I execute the two commands in two steps?
I have some problems with the syntax of the commands... I just cannot understand why they dont work...

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Compilation of .po files
January 28, 2008, 09:27:53 pm
First, obviously your script must execute from inside the directory.

Second, yes, you can do the commands in two steps – sorry for not suggesting this earlier:

Code: [Select]
msgcat -o civicrm.po *.po
msgfmt -o civicrm.mo civicrm.po
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

korell

  • Guest
Re: Compilation of .po files
January 28, 2008, 11:43:03 pm
Thanks!

When I try to run the commands I get this error:
Error opening *.po for reading. Invalid argument.

Then about 20 errormessages like this:
Duplicated definition of message
..this is the location of the first definition

Then...:
Too many errors. Aborting.

I'm statring to think that the win32-version of these commands have some bugs or work differently than in the unix world.

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Compilation of .po files
January 29, 2008, 12:28:49 am
Well, I haven’t used Windows shell in years… What about explicitly spelling out the file names?

Code: [Select]
msgcat -o civicrm.po calendar.po civicrm-core.po civicrm-helpfiles.po civicrm-modules.po countries.po drupal-civicrm.po provinces.po
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

korell

  • Guest
Re: Compilation of .po files
January 29, 2008, 09:51:07 pm
Thanks a lot! That solved the case. No errors this time.

:)

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Compilation of .po files
January 30, 2008, 03:31:55 pm
Please add instructions to the existing documentation covering how to do this in a Windows shell - so others don't have to go through the same hassles :-)
Protect your investment in CiviCRM by  becoming a Member!

HanV

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 0
Re: Compilation of .po files
February 25, 2008, 01:59:10 am
I have the same problem as Korell.

I have worked with Pootle on the translation. Then I use the Zip-link to get the 7 different po-files on my PC (Windows, Drupal, poedit).
I first tried to get the new translation by importing the po-files with drupal, but that won't work because civicrm uses the mo-files.
I can translate each po-file with poedit to the mo-file, but it seems that there should be only one mo-file: civicrm.mo

I have combined the po-files to one po-file and translated that (poedit), but then I get the errors that the texts are not unique.

How can I use msgcat and msgfmt on Windows, or how do I create one mo-file?

HanV

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Compilation of .po files
February 28, 2008, 03:29:14 am
You don’t have to combine the PO files into one by hand (and definitely it’s not good doing it for translation, as we can’t get it back into CiviCRM in an easy way; it’s doable, just not trivial).

Basically, the best approach is to translate the PO files one by one. Once you want to check the translation, create a unique file out of them (with msgcat) and then compile it into a MO file (with msgfmt):

Code: [Select]
msgcat -o civicrm.po calendar.po civicrm-core.po civicrm-helpfiles.po civicrm-modules.po countries.po drupal-civicrm.po provinces.po
msgfmt -o civicrm.mo civicrm.po

If there are non-unique strings, feel free to delete one of them (but it shouldn’t happen with the current files).
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • Compilation of .po files

This forum was archived on 2017-11-26.