#!/bin/bash #I wrote this because autoconf is confusing as bloody hell. #I just need to copy some files into a place where gettext will expect them #I Shouldn't need to create some mega ultimate makefile.am for that, then #follow some random poorly documented hierarchy and naming system. (Looking at you gettextize!) #Usage: makeTranslation [install|update] #extract program name from sources -- Now with added case sensitivity hack! PROGRAM_NAME=`cat ../src/common/constants.cpp | grep PROGRAM_NAME | awk -F= '{print $2}' | sed 's/;//g' | sed 's/\"//g' | sed 's/;//' | sed 's/^\s*//'` #Where do we want to install the translations? (if using this script). TRANSLATION_INSTALL="/home/pcuser/mingw64/code/3Depict/locale/" #Space separated list of maintained locales MAINTAINED_LOCALES="de_DE fr_FR es_ES" echo "Program name is $PROGRAM_NAME" if [ x"$PROGRAM_NAME" == x"" ] ; then echo "Unable to extract program name. Aborting" exit 1; fi if [ $# -eq 0 ] ; then echo "Creating binary translation files.." #Create binary versions of gettext translation files for i in *.po do #Quick check to see if we have any "" elements in the files if [ x"`grep ' tmp.pot #replace the default headers from msgmerge THISYEAR=`date | awk '{print $6}'` sed -i "s/YEAR THE PACKAGE.*/$THISYEAR/" tmp.pot sed -i "s/SOME DESCRIPTIVE TITLE.*/Translation file for locale $i/" tmp.pot sed -i 's/PACKAGE package/3Depict package/' tmp.pot #overwrite po mv tmp.pot ${PROGRAM_NAME}_${i}.po done echo "Replacing base template" msgmerge -N ${PROGRAM_NAME}_base.pot update.pot > tmp.pot mv tmp.pot ${PROGRAM_NAME}_base.pot rm update.pot fi fi