wiki:UsingGetText

Using getText interface (.po/.mo) files with Transposh

Transposh filter since v0.6.3 includes support for using external translation files provided by wordpress and other plugins. this is done automatically by setting the locale appropriately and letting wordpress do its thing.

Strings that are found to be already translated in this interface won't be manipulated again by Transposh. This works especially well for the common strings and interface translations. And you will immediately notice less clutter in the translation editing screen

However - to enable this, you need to grab the appropriate .po/.mo files and put them in the wp-content/languages dir.

Luckily enough - most of the files can be located at http://svn.automattic.com/wordpress-i18n

Scripts for grabbing .po/.mo files

We also provide a script for downloading those files with ease (for linux, wget and bash required). Notice that not all languages does have an appropriate translation file on wordpress yet, or there is something that evaded us, if you know of more locations, please inform us.

This is for Wordpress:

LOCALES=( af sq ar hy az eu be bg_BG ca zh_CN zh_TW hr cs_CZ da_DK nl et fi fr_FR gl_ES ka_GE de_DE el ht he_IL hi_IN hu_HU is id_ID ga it_IT ja ko_KR lv lt mk_MK ms_MY mt nb_NO f
a_IR pl_PL pt_PT ro_RO ru_RU sr_RS sk_SK sl_SI es_ES sw sv_SE tl th tr_TR uk ur vi cy yi )
for LOCALE in "${LOCALES[@]}"
do
  echo "working on locale: $LOCALE"
  FILES=( continents-cities-$LOCALE.mo continents-cities-$LOCALE.po $LOCALE.po $LOCALE.mo ms-$LOCALE.po ms-$LOCALE.mo )
  for FILE in "${FILES[@]}"
  do
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/tags/3.3/messages/$FILE"
    fi
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting from older..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/tags/3.2.1/messages/$FILE"
    fi
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting from trunk..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/trunk/messages/$FILE"
    fi
  done
done

This is for Twentyten:

LOCALES=( af sq ar hy az eu be bg_BG ca zh_CN zh_TW hr cs_CZ da_DK nl et fi fr_FR gl_ES ka_GE de_DE el ht he_IL hi_IN hu_HU is id_ID ga it_IT ja ko_KR lv lt mk_MK ms_MY mt nb_NO f
a_IR pl_PL pt_PT ro_RO ru_RU sr_RS sk_SK sl_SI es_ES sw sv_SE tl th tr_TR uk ur vi cy yi )
for LOCALE in "${LOCALES[@]}"
do
  echo "working on locale: $LOCALE"
  FILES=( $LOCALE.po $LOCALE.mo )
  for FILE in "${FILES[@]}"
  do
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/tags/3.3/messages/twentyten/$FILE"
    fi
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting from older..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/tags/3.2.1/messages/twentyten/$FILE"
    fi
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting from trunk..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/trunk/messages/twentyten/$FILE"
    fi
  done
done

This is for Twentyeleven:

LOCALES=( af sq ar hy az eu be bg_BG ca zh_CN zh_TW hr cs_CZ da_DK nl et fi fr_FR gl_ES ka_GE de_DE el ht he_IL hi_IN hu_HU is id_ID ga it_IT ja ko_KR lv lt mk_MK ms_MY mt nb_NO f
a_IR pl_PL pt_PT ro_RO ru_RU sr_RS sk_SK sl_SI es_ES sw sv_SE tl th tr_TR uk ur vi cy yi )
for LOCALE in "${LOCALES[@]}"
do
  echo "working on locale: $LOCALE"
  FILES=( $LOCALE.po $LOCALE.mo )
  for FILE in "${FILES[@]}"
  do
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/tags/3.3/messages/twentyeleven/$FILE"
    fi
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting from older..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/tags/3.2.1/messages/twentyeleven/$FILE"
    fi
    if [ ! -e "$FILE" ]
    then
        echo "not exists $FILE - getting from trunk..."
        wget "http://svn.automattic.com/wordpress-i18n/$LOCALE/trunk/messages/twentyeleven/$FILE"
    fi
  done
done

Editing those files later

After grabbing those files and correctly placing them, you will notice that translation is now better in some places, if you still want to edit said translation, we recommend codestyling localization plugin http://wordpress.org/extend/plugins/codestyling-localization

Last modified 2 years ago Last modified on 12/29/2011 06:49:52 PM