Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've just done this for a project I'm working on, for us the process is like this:</p> <p>First, I have a POTFILES.in file which contains a list of source files needing translation. We actually have two files (e.g. admin.in and user.in), as the admin interface doesn't always need translating. So we can send translators only the file containing strings the users see.</p> <p>Running the following command will create a .pot template from the POTFILES.in:</p> <pre><code>xgettext --files-from=POTFILES.in --directory=.. --output=messages.pot </code></pre> <p>Run the above command from the po/ directory, which should be a subdirectory of your project and contain the POTFILES.in file. The .pot file has the exact same format as a .po file, but it is a template containing no translations. You create a new template whenever new translatable strings have been added to your source files.</p> <p>To update the already translated .po files and add new strings to them, run:</p> <pre><code>msgmerge --update --no-fuzzy-matching --backup=off da.po messages.pot </code></pre> <p>In the above example I disable fuzzy matching, as our strings are a mess and it did more harm than good. I also disabled backup files, as everything is in subversion here. Run the above command for each language, in this case I updated the danish translation.</p> <p>Finally run msgfmt to create the .mo files from the .po files:</p> <pre><code>msgfmt nl.po --output-file nl.mo </code></pre> <p>Ofcourse, you wouldn't want to run this manually everytime, so create some scripts (or preferably one or more Makefiles) to do this for you.</p> <p>Note that your directory layout is slightly different from my situation, so you will have to adjust output filenames/paths a bit, but the steps should be the same.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload