Author Topic: Detailed instructions in how to create new translation in Windows  (Read 4653 times)

Offline kasiawaka

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 2
    • Freeform Solutions
I spend several hours trying to understand the translation process and how I can quickly (without having to join translation team and providing translation online etc.) translate several phrases for French and Spanish that were not yet "officially" translated (the phrases are still in English when viewing pages in FR or ES).
The reason I need to do "offline translation" is that the translation was provided to me by a client and I don't really know if it's a "proper" translation or a customized text that is not good enough for "official" translation.

Here is the procedure that works for me (Windows based):

1. Download (one by one, all 18 of them, what a pain) *.po translation files for your current CiviCRM version from http://www.transifex.net/projects/p/civicrm/

For example, all translations for CiviCRM 3.3 are here: http://www.transifex.net/projects/p/civicrm/r/civicrm-33/:
All *.po files for CiviCRM 3.3 French (fr_FR) are here: http://www.transifex.net/projects/p/civicrm/r/civicrm-33/l/fr/
All *po files for CiviCRM 3.3 Spanish (es_ES) are here: http://www.transifex.net/projects/p/civicrm/r/civicrm-33/l/es/

Note: you will need to create an account for this purpose but it's quick and easy - follow instructions on transifex


2. Download Poedit application (http://sourceforge.net/projects/poedit/) that will help you translate chosen strings. Install it.


3. Now you can double click on each of the .po files, find the string you want to translate and provide the translation. Save the file.


4. Once done adding all the translation strings, copy all .po files (there should be 18 of them) to the bin folder in the location where Poedit was installed.

For example, in Windows standard installation for Poedit would be C:\Program Files\Poedit\bin


5. Open command prompt, navigate to the same location C:\Program Files\Poedit\bin

For those who haven't used Windows command prompt for a while, execute the following 2 commands:
Code: [Select]
cd /
 cd program files/poedit/bin


6. Join all separate .po files into one civicrm.po file by typing in the command prompt:
Code: [Select]
msgcat -o civicrm.po *.po

7. Compile the civicrm.po file into civicrm.mo by typing in the command prompt:
Code: [Select]
msgfmt -o civicrm.mo civicrm.po

8. Copy newly created civicrm.mo file into a proper directory to replace the original file (for example, to replace FR file, copy it to sites/all/modules/civicrm/l10n/fr_FR [Drupal path])


Resources:


Annex: For those who wonder how to decompile .mo file into .po file:
Copy .mo file to Poedit bin directory
Using command prompt, navigate to poedit/bin directory and execute:
Code: [Select]
msgunfmt input.mo > output.po
Use Poedit to edit that new .po file.


Good luck
Kasia
--
Kasia Wakarecy,
Freeform Solutions - NFP IT support for charities and other NFP

Offline Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Detailed instructions in how to create new translation in Windows
« Reply #1 on: March 18, 2011, 08:36:29 am »
Hey (and long time no see…), thanks, this is most appreciated!

I’m coming up with a better l10n solution for 3.4.beta1/4.0.beta1 which should show up sometime next week, one that would end the split of POT files per CiviCRM version and simply have one set of PO files covering the most recent versions (3.3-4.0). I’ll update the docs accordingly once it’s in place.

Offline mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 405
  • Karma: 28
    • Personal site
  • CiviCRM version: most of them
  • CMS version: Drupal
Re: Detailed instructions in how to create new translation in Windows
« Reply #2 on: March 18, 2011, 01:20:47 pm »
This is not directly related, but as the maintainer for fr and fr_CA, I have been having a bit of a rough time doing QA/review on the contributed translations, so I started using the command line transifex tool.

I wrote a short howto here:
https://wiki.koumbit.net/CiviCrm/Transifex

It is rather helpful to merge and diff files (combined with git).

Offline thoni56

  • I post occasionally
  • **
  • Posts: 34
  • Karma: 1
  • CiviCRM version: 4.2.7
  • CMS version: Joomla 2.5.14
Re: Detailed instructions in how to create new translation in Windows
« Reply #3 on: March 21, 2011, 11:35:31 pm »
I'm doing it the other way around, kind of:

- edit in Transifex online
- pull all translations using "tx pull"
- merge into .mo
- install in local site

Doing the three last steps in a Makefile (on Windows a batchfile would work fine) makes it a fairly quick and easy round trip/feedback loop.

Offline Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Detailed instructions in how to create new translation in Windows
« Reply #4 on: March 29, 2011, 05:40:16 am »
As per the latest blog post, I finally managed to come up with a unified (version-agnostic) set of POT/PO files.

The bad news is that you need to adjust your Transifex resources; the good news is that it’s so much simpler to manage now. :)

Do let me know if you have any questions.

Offline MichaS.

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 3.5.5
  • CMS version: Joomla 1.57
  • MySQL version: actual
  • PHP version: 5.x
Re: Detailed instructions in how to create new translation in Windows
« Reply #5 on: April 12, 2011, 06:20:16 am »
Dzien dobre Piotr,

its not possible at the moment to update automaticlly the actual langfiles? I translate in Transflex and hope can use nearly by my translations in german

Michael from de_DE

Offline Piotr Szotkowski

  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: Detailed instructions in how to create new translation in Windows
« Reply #6 on: May 10, 2011, 06:16:51 am »
its not possible at the moment to update automaticlly the actual langfiles?

Unfortunately not. :| It used to be that Transifex pushed the translations live to the Git repository, in which case it was possible to have a post-commit that would recompile the translations, but currently it’s a manual (once-a-week or on request) process on my end to pull from Transifex and recompile the files.

Tschüß!

Offline reswild

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.1.6
  • CMS version: Drupal
  • MySQL version: MariaDB 5.5
  • PHP version: 5.3
Re: Detailed instructions in how to create new translation in Windows
« Reply #7 on: February 05, 2012, 05:01:20 pm »
The instructions on the wiki page (wiki.civicrm.org/confluence/display/CRMDOC40/CiviCRM+Localisation) for compiling translations on Windows is a bit misleading. It tells you to use GetText tools and gives a link to the GetText page at sourceforge.net (gnuwin32.sourceforge.net/packages/gettext.htm). This page, however, will only give you GetText version 0.14.4, and this will not work with the CiviCRM translation files because it doesn't support msgctxt strings.

Poedit for Windows includes a newer version of the GetText tools that will work.

Offline nardanz

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: joomla
  • MySQL version: 5
  • PHP version: 5
Re: Detailed instructions in how to create new translation in Windows
« Reply #8 on: September 22, 2013, 10:52:18 pm »
NOTE: Open command prompt as administrator