Internationalization for the oik suite of plugins
The base domain.pot file(s) are named to match the plugin. e.g. oik.pot, oik-i18n.pot
Translators build Machine Object (.mo) files where the filenames are expected to be in the form:
domain-la_CY.mo
where domain is the plugin domain ( e.g. "oik" or "oik-i18n" ) la is the 2 digit abbreviation of the language (e.g. en, fr, de, it ) CY - is the 2 digit code for the country ( e.g. GB, FR, DE, IT, CH, CA, US )
So the French version for the "oik" plugin/domain would be oik-fr_FR.mo
POT files After the strings are marked in the source files, a utility routine ( sometimes called xgettext ) is used to extract the original strings and to build a template translation POT file. Here is an example POT file entry:
msgid "Sign Out" msgstr ""
Here is another for singular and plural
Here is another where there's more than one line in the string
to be completed.
This is not really necessary, as the logic is currently intended for use in a 'batch build' environment.
http://ottopress.com/2012/internationalization-youre-probably-doing-it-wrong/
load_textdomain http://codex.wordpress.org/Function_Reference/load_textdomain
load_plugin_textdomain load_theme_textdomain
We use bb_BB for a fictitious test language and country
bb = bbboing language - an automatic translation of the existing language with character movement and vowel replacement BB = Bbboingland - the country where bbboing is spoken
This is the library that attempts to update the language files for the plugin.
la = language CY = CountrY
It's invoked by the oik-zip plugin as part of the l10n processing.
oik-i18n.php - plugin file l10n.php - la_CY.php - bb_BB.php -
makeoik.php is a PHP routine based on WordPress's makepot.php
It extends the list of functions that accept Internationalized strings so that they can be found and included in the master .pot file for a plugin. This .pot file is then passed to the translators ( including the automated routines ) for creation of the .po files... from which the .mo files are built.
Here we use oik-batch to invoke the l10n routine - localize a plugin
php c:\apache\htdocs\wordpress\wp-content\plugins\oik-batch\oik-batch.php c:\apache\htdocs\wordpress\wp-content\plugins\oik-i18n\l10n.php %*
if you have a 'batch' file then you should be able to use
batch oik-i18n\l10n
msgfmt - to convert .po to .mo files
For simple text translation
Examples:
e( "Hello" ); -> bwt( "Hello" );
e( "
" ); -> unchanged
e( "Hello $fred" ); -> e( sprintf( __( 'Hello %1$s', "textdomain"), $fred ) );
OR possibly:
bwt( "Hello" );
e( " $fred" );
it depends on the usage.
Notes:
Don't get confused by the WordPress method, which effectively ignores the PHP locale.
Yes - see above
Now supports plugins which deliver blocks built with wp-scripts
If you want to read more about the oik plugins then please visit the oik plugin "the oik plugin - for often included key-information"