Skip to content

Instantly share code, notes, and snippets.

@kwk
Created September 29, 2011 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwk/1251005 to your computer and use it in GitHub Desktop.
Save kwk/1251005 to your computer and use it in GitHub Desktop.
Translating JavaScript files
translate:
#
#---------------------------------------------------------------------------
# Extracting new language strings and merging them in to one file
#---------------------------------------------------------------------------
#
cp ${LOCALE_FILE_PATH} ${LOCALE_FILE_PATH_BACKUP}
find ${APP_JS_PATH} ${EXT_JS_PATH}/examples/ux -name "*.js" | xgettext -L C -n -o ${LOCALE_FILE_PATH}.new --files=-
# Merge translations
msgmerge ${LOCALE_FILE_PATH_BACKUP} ${LOCALE_FILE_PATH}.new --output-file=${LOCALE_FILE_PATH}.merged &> /dev/null
# Filter out duplicates
msguniq ${LOCALE_FILE_PATH}.merged --output-file=${LOCALE_FILE_PATH} &> /dev/null
# Manually edit translations
poedit ${LOCALE_FILE_PATH}.merged
cp -f ${LOCALE_FILE_PATH}.merged ${LOCALE_FILE_PATH}
# i18n: Converting PO files to JSON
js/gettext/bin/po2json -p ${LOCALE_PATH}/de_DE.po > ${LOCALE_PATH}/de_DE.po.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment