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) »
  • High speed update of your .mo files
Pages: [1]

Author Topic: High speed update of your .mo files  (Read 561 times)

erwindeclerck

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.4.9 + 4.5.2 + 4.5.4 + 4.5.5
  • CMS version: 7
  • MySQL version: 5.5.40
  • PHP version: 5.3.10-1ubuntu3.15
High speed update of your .mo files
November 19, 2014, 06:50:04 am
It took me at least a night to get gettext up and running on Windows.  >:(
As soon as you know how it works, it's simple. As usual...  ;)

The command line tool works perfect but in order to speed up production I wrote a little .bat file.

1. Dowload or git clone your po files from https://github.com/civicrm/l10n
2. Download or git clone the Windows version of gettext https://github.com/vslavik/gettext-tools-windows/releases
3. replace the bin folder from (1.) with the one from (2.) (same .sh files + .exe files)
4. create a po/ folder inside workdir/
3. Create a .bat file in the root of this l10n folder. eg. po2mo.bat as follows:

@ECHO OFF
bin\msgcat.exe -o workdir\po\civicrm.po po\YOUR_LANGUAGE\*.po
bin\msgfmt.exe -o workdir\mo\civicrm.mo workdir\po\civicrm.po
@ftp -i -s:"%~f0"&GOTO:EOF
open YOURDOMAIN
YOURLOGIN
YOURPASS
!:--- FTP commands below here ---
lcd C:\PATH_TO_YOUR_LOCAL_FOLDER\l10n\workdir\mo
cd  /PATH_TO_YOUR_REMOTE_FOLDER/civicrm/l10n/YOUR_LANGUAGE/LC_MESSAGES
binary
mput "*.*"
disconnect
bye

I open all the .po files of my language in a texteditor (I use EditPad Pro 7, but others are fine too) and search for a pattern in all these files.

EditPad Pro offers the possibility to fire a custom script from a custom button. I coupled my .bat file to it and hups, my translations are up to date in seconds.

Hope this can help someone else too.  :)

Kind regards.

Erwin


mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: High speed update of your .mo files
November 20, 2014, 07:59:28 am
Hi Erwin,

Thanks for sharing!

For what it's worth, there are daily compiled language files available:
https://download.civicrm.org/civicrm-l10n-core/mo/xx_XX/civicrm.mo (where xx_XX is your language code, such as es_ES)

Meaning that if you use Transifex to translate CiviCRM (https://www.transifex.com/projects/p/civicrm/), the changes will be available the day after at the above URL.

The files are also available for extensions, using URLs in the form of:
https://download.civicrm.org/civicrm-l10n-extensions/mo/$extname/xx_XX/$extname.mo

There is also an extension that can help with automatically downloading the translation files:
https://github.com/cividesk/com.cividesk.l10n.update

Mathieu
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

erwindeclerck

  • I’m new here
  • *
  • Posts: 12
  • Karma: 0
  • CiviCRM version: 4.4.9 + 4.5.2 + 4.5.4 + 4.5.5
  • CMS version: 7
  • MySQL version: 5.5.40
  • PHP version: 5.3.10-1ubuntu3.15
Re: High speed update of your .mo files
November 20, 2014, 11:11:10 am
Thanks Mathieu,

Transifex was the first option I tried. But -unless I do something wrong- the production speed is horribly slow.
Just to find a string within all files is very time consuming. Perhaps it's because I'm not a member of a translating team yet.
Finding strings in all my local files is a matter of seconds. After keying in the corrections, with the little .bat file I have my updated language file up and running on the server within less than a few seconds.
I haven't done it yet, but the next step would be to commit the changes in my .po files and merge them with the changes I pull from https://github.com/cividesk/com.cividesk.l10n.update.
How I should share my corrections later on towards Transifex isn't clear yet.

To my experience, being able to correct errors immediately while I am going through the installation/configuration process is a huge advantage.

Greetings,
Erwin

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Discussion »
  • Internationalization and Localization (Moderators: Michał Mach, mathieu) »
  • High speed update of your .mo files

This forum was archived on 2017-11-26.