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) »
  • how to create my own po files
Pages: [1]

Author Topic: how to create my own po files  (Read 7151 times)

ositoblanco

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
how to create my own po files
February 08, 2009, 02:58:54 pm
Hello, I have done some changes in the CiviCRM Core / Contribute to use direct debit for payment instead of credit cards. This work I've almost finished and want to make it to a feature request issue for CiviCRM.

Now I need to translate the recently added strings. But I dont know how to create the pot / po files. I found the bin/create-pot-files.sh script but I'm not able to use it. Would be nice to have a readme for how to create pot files.

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: how to create my own po files
February 09, 2009, 04:05:28 am
Quote from: ositoblanco on February 08, 2009, 02:58:54 pm
Hello, I have done some changes in the CiviCRM Core / Contribute to use direct debit for payment instead of credit cards. This work I've almost finished and want to make it to a feature request issue for CiviCRM.

Great! Please create an issue in issue tracker and attach the patch.

Quote
Now I need to translate the recently added strings. But I dont know how to create the pot / po files.

If there are only few strings, you can create the POT/PO files manually; if your patches get accepted, the strings most probably end up in civicrm-modules.pot file.

Quote
I found the bin/create-pot-files.sh script but I'm not able to use it. Would be nice to have a readme for how to create pot files.

This is supposed to simply work out of the box when ran from the main CiviCRM directory (so just by running bin/create-pot-files.sh). This script requires Bash, gettext and the sponge utility (found in the moreutils package on Debian/Ubuntu).

What are the errors that you get with this script?
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.

ositoblanco

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
Re: how to create my own po files
February 09, 2009, 10:57:20 am

Quote
This is supposed to simply work out of the box when ran from the main CiviCRM directory (so just by running bin/create-pot-files.sh). This script requires Bash, gettext and the sponge utility (found in the moreutils package on Debian/Ubuntu).

What are the errors that you get with this script?

Code: [Select]
sh bin/create-pot-files.sh
tee: bin/../l10n/pot/LC_MESSAGES/civicrm-menu.pot: No such file or directory
tee: bin/../l10n/pot/LC_MESSAGES/civicrm-core.pot: No such file or directory
tee: bin/../l10n/pot/LC_MESSAGES/civicrm-modules.pot: No such file or directory
... snip
Code: [Select]
* building civcrm-menu.pot
bin/create-pot-files.sh: line 33: bin/../l10n/pot/LC_MESSAGES/civicrm-menu.pot: No such file or directory
tail: illegal option -- -
usage: tail [-F | -f | -r] [-b # | -c # | -n #] [file ...]
 * building countries.pot
bin/create-pot-files.sh: line 35: bin/../l10n/pot/LC_MESSAGES/countries.pot: No such file or directory
grep: xml/templates/civicrm_country.tpl: No such file or directory
 * building civicrm-core.pot
bin/create-pot-files.sh: line 51: bin/../l10n/pot/LC_MESSAGES/civicrm-core.pot: No such file or directory
msgcomm: Öffnen der Datei »bin/../l10n/pot/LC_MESSAGES/civicrm-core.pot« zum Lesen fehlgeschlagen: No such file or directory
bin/create-pot-files.sh: line 55: sponge: command not found
msgcomm: Öffnen der Datei »bin/../l10n/pot/LC_MESSAGES/civicrm-core.pot« zum Lesen fehlgeschlagen: No such file or directory
msgcomm: Öffnen der Datei »bin/../l10n/pot/LC_MESSAGES/civicrm-core.pot« zum Lesen fehlgeschlagen: No such file or directory
bin/create-pot-files.sh: line 57: sponge: command not found
msgcomm: Öffnen der Datei »bin/../l10n/pot/LC_MESSAGES/civicrm-core.pot« zum Lesen fehlgeschlagen: No such file or directory
... snip

I don't know why my command line talks to me in german.

Öffnen der Datei: == Open File:
zum Lesen fehlgeschlagen: == reading error

I'm working on mac os 10.5.6 ... there is no sponge.

Maybe I should download the files for l10n/pot/LC_MESSAGES/* ? Or rename the l10n/xx_XX/LC_MESSAGES to l10n/pot/LC_MESSAGES?

BTW: The way with the custom_civicrm.po file works fine. This file I also use for getting in new translations (which are not yet translated). I put them in the custom po file (and add them also to the translation server).

Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: how to create my own po files
February 10, 2009, 04:12:35 am
Quote from: ositoblanco on February 09, 2009, 10:57:20 am
Code: [Select]
sh bin/create-pot-files.sh
tee: bin/../l10n/pot/LC_MESSAGES/civicrm-menu.pot: No such file or directory
tee: bin/../l10n/pot/LC_MESSAGES/civicrm-core.pot: No such file or directory
tee: bin/../l10n/pot/LC_MESSAGES/civicrm-modules.pot: No such file or directory

This means you don’t have the l10n/pot/LC_MESSAGES directory. In general, this script is only used by us when working on a Subversion checkout from our repository, rather than compiled tarballs – but you can simply create that directory and the POT files should appear in it.

Quote
Code: [Select]
* building civcrm-menu.pot
bin/create-pot-files.sh: line 33: bin/../l10n/pot/LC_MESSAGES/civicrm-menu.pot: No such file or directory
tail: illegal option -- -
usage: tail [-F | -f | -r] [-b # | -c # | -n #] [file ...]

You can try replacing the tail --lines=+2 call with tail -n +2

The other errors mean that you lack the POT files generated in the previous step and that you lack the sponge utility..

Quote
I don't know why my command line talks to me in german.

Because you have a German locale in your shell. You can change this by temporarily resetting the locale to C like this: LC_MESSAGES=C bin/create-pot-files.sh or LC_ALL=C bin/create-pot-files.sh

Quote
I'm working on mac os 10.5.6 ... there is no sponge.

Unfortunately, I have zero experience with OS X. sponge basically takes the input from the command line, caches it and writes to a file when done (so something else can read the original of the file in the meantime). If you know a bit of shell programming you can side-step this by redirecting to a temp file and then renaming the file on the next line. Also, a quick googling suggests moreutils are available through Darwin Ports.

Quote
Maybe I should download the files for l10n/pot/LC_MESSAGES/* ? Or rename the l10n/xx_XX/LC_MESSAGES to l10n/pot/LC_MESSAGES?

You can download the POT files from our repository: http://svn.civicrm.org/civicrm/branches/v2.1/l10n/pot

Quote
BTW: The way with the custom_civicrm.po file works fine. This file I also use for getting in new translations (which are not yet translated). I put them in the custom po file (and add them also to the translation server).

(You also need to gettext-compile all of the PO files to an MO file named civicrm.mo, of course.)
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.

ositoblanco

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
Re: how to create my own po files
February 17, 2009, 12:52:56 pm
Thank you for your extensive explanations. BTW I've opened the issue for direct debit payment (http://issues.civicrm.org/jira/browse/CRM-4138)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • how to create my own po files

This forum was archived on 2017-11-26.