Moved generateTranslationDiffs.sh to tools folder.
This commit is contained in:
@@ -8,7 +8,9 @@ Translations are loaded for a given term at three levels:
|
||||
|
||||
Developers who are adding a new feature should add new strings *only* to default. This file
|
||||
should be comprised of basic English text. It will be used in the event that there are no
|
||||
more specific languages specified.
|
||||
more specific languages specified. Once you have modified default, you should run
|
||||
./tools/generateTranslationDiffs.sh (bash script) which will re-generate the localizations
|
||||
with commented out additions which you have just added.
|
||||
|
||||
Translators should in general implement the <Language> file. This is the generic translation
|
||||
for a given language; for instance, 'French', 'German', 'Norsk', etc. If a string exists in
|
||||
@@ -29,11 +31,11 @@ If a locale file is used, it is applied in the same manner as <Language> is to d
|
||||
will override any keys present from the ones in the language file (and in turn, the default).
|
||||
|
||||
|
||||
It is recommended to look for differences from default using a text editor with compare cabailities.
|
||||
For ease of maintentance, you should insert new entries in alphabetical order. Comments *may*
|
||||
be included, but in general you should try to avoid them as they can confuse comparison editors. If
|
||||
you do include comments, you should prefix each line with 00, 01, etc so that the file can be sorted
|
||||
and still keep comments in correct order, e.g.
|
||||
After the generateTranslationDiffs.sh has been run, all untranslated terms for a given language /
|
||||
locale will exist at the end of the file, prefixed by a ! comment marker. Translators should
|
||||
go through this section of the file and translate all terms which they can. After you have translated
|
||||
a line, just remove the ! comment marker. Comments may bee included using the #xx comment marker, where
|
||||
xx is a numeric prefix used to make sure automated sorting keeps comments in the right order, e.g.:
|
||||
|
||||
#00 Comment line 1...
|
||||
#01 Line 2...
|
||||
|
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Append translation differences on the end of all files. Developers should run this script
|
||||
# after changing default, so that translators can easily see what items need to be translated.
|
||||
|
||||
TEMP=temp_file
|
||||
|
||||
#First thing, we want to strip default of any !s and duplicates.
|
||||
cat "default" | grep -v '^!' | sort | uniq > "$TEMP"
|
||||
mv "$TEMP" "default"
|
||||
|
||||
echo "Generating differences... this may take a few minutes."
|
||||
|
||||
find . |
|
||||
grep -v 'default' |
|
||||
grep -v 'README' |
|
||||
grep -v 'LICENSE' |
|
||||
grep -v 'generateDiffs.sh' |
|
||||
grep -v "$TEMP" |
|
||||
grep -v '^.$' |
|
||||
|
||||
while read X; do
|
||||
echo "Working on differences for $X"
|
||||
|
||||
#Start by copying the existing file to a temporary one, after sorting and removing all
|
||||
#previous differences
|
||||
cat "$X" | grep -v '^!' | sort | uniq > "$TEMP"
|
||||
|
||||
echo -e "\n\n!!!!!!!!!!!!!!!!!!!!!!!!!\n! Untranslated keys follow; remove the ! prefix after an entry is translated.\n!!!!!!!!!!!!!!!!!!!!!!!!!\n\n" >> "$TEMP"
|
||||
|
||||
cat 'default' | grep -v '^#' | while read LINE; do
|
||||
KEY=`echo "$LINE" | cut -f 1 -d ';'`
|
||||
grep -q "^$KEY" "$X";
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "!$LINE" >> "$TEMP"
|
||||
fi
|
||||
done
|
||||
|
||||
#Replace the old file with the new one, with a section at the end for differences.
|
||||
mv "$TEMP" "$X"
|
||||
done
|
||||
|
||||
echo "Finished generating differences."
|
Reference in New Issue
Block a user