From 296f75f86464a9bb6d661f09e06f16441dafec75 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Tue, 26 Apr 2016 16:26:02 +0300 Subject: [PATCH] [localization] Remove extra scripts and files for countries_names --- .../countries_names.txt | 0 localization/countries_names/languages.txt | 1 - .../countries_names/csv_to_txt.py | 30 ------------------- .../generate_countries_names.sh | 26 ---------------- .../countries_names/mk_lang_dirs.py | 14 --------- tools/unix/generate_localizations.sh | 16 +++++----- 6 files changed, 9 insertions(+), 78 deletions(-) rename {localization/countries_names => data}/countries_names.txt (100%) delete mode 100644 localization/countries_names/languages.txt delete mode 100755 tools/localization/countries_names/csv_to_txt.py delete mode 100755 tools/localization/countries_names/generate_countries_names.sh delete mode 100755 tools/localization/countries_names/mk_lang_dirs.py diff --git a/localization/countries_names/countries_names.txt b/data/countries_names.txt similarity index 100% rename from localization/countries_names/countries_names.txt rename to data/countries_names.txt diff --git a/localization/countries_names/languages.txt b/localization/countries_names/languages.txt deleted file mode 100644 index 3d60b4b906..0000000000 --- a/localization/countries_names/languages.txt +++ /dev/null @@ -1 +0,0 @@ -en zh-Hans vi it zh-Hant ar cs id es ru nl pt nb tr th ro pl fr de da fi hu ja he ko sv sk uk diff --git a/tools/localization/countries_names/csv_to_txt.py b/tools/localization/countries_names/csv_to_txt.py deleted file mode 100755 index 8049f0368d..0000000000 --- a/tools/localization/countries_names/csv_to_txt.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/python - -import sys, csv - -if len(sys.argv) < 4: - print 'Converting Google Docs translation CSV to strings.txt format' - print 'Translation valid only for page "Small mwm names" in document:' - print 'https://docs.google.com/spreadsheets/d/1dKhThUersOGoUyOCx5OfGMXEjs1LBmTFcIsTc_nGxZc/edit#gid=1022107578' - print 'Usage: {0} '.format(sys.argv[0]) - sys.exit(1) - -def GetName(n): - return n[:n.index(' ')] - -languages = set() - -with open(sys.argv[2], 'w') as o: - with open(sys.argv[1], 'r') as f: - reader = csv.reader(f) - reader.next() - header = reader.next() - for row in reader: - print >> o, '[{0}]'.format(row[0]) - for i in range(1, len(header)): - languages.add(GetName(format(header[i]))) - print >> o, '{0}{1}'.format(header[i], row[i]) - print >> o - -with open(sys.argv[3], 'w') as l: - print >> l, " ".join(languages) diff --git a/tools/localization/countries_names/generate_countries_names.sh b/tools/localization/countries_names/generate_countries_names.sh deleted file mode 100755 index 208294f93d..0000000000 --- a/tools/localization/countries_names/generate_countries_names.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -e -u -x - -MY_PATH="`dirname \"$0\"`" # relative -MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized - -readonly TMP_DIR=$MY_PATH/../../../localization/countries_names-tmp -readonly DATA_DIR=$MY_PATH/../../../localization/countries_names - -rm -rf $TMP_DIR -mkdir $TMP_DIR - -python $MY_PATH/csv_to_txt.py $DATA_DIR/countries_names.csv $DATA_DIR/countries_names.txt $DATA_DIR/languages.txt - -mkdir $TMP_DIR/json - -python $MY_PATH/mk_lang_dirs.py $DATA_DIR/languages.txt $TMP_DIR/json/ -$MY_PATH/../../twine/twine --format jquery generate-all-string-files $DATA_DIR/countries_names.txt $TMP_DIR/json - -readonly OUTPUT_DIR=$MY_PATH/../../../data/countries-strings/ -if [ ! -d $OUTPUT_DIR ]; then - mkdir $OUTPUT_DIR -fi -cp -R $TMP_DIR/json/ $OUTPUT_DIR -rm -rf $TMP_DIR diff --git a/tools/localization/countries_names/mk_lang_dirs.py b/tools/localization/countries_names/mk_lang_dirs.py deleted file mode 100755 index 3738bc7319..0000000000 --- a/tools/localization/countries_names/mk_lang_dirs.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/python - -import os, sys - -if len(sys.argv) < 3: - print 'Creation or resource directories for the languages' - print 'Usage: {0} '.format(sys.argv[0]) - sys.exit(1) - -with open(sys.argv[1], "r") as langs_file: - for lang in langs_file.read().split(): - new_dir = os.path.join(sys.argv[2], lang + ".json") - if not os.path.exists(new_dir): - os.makedirs(new_dir) diff --git a/tools/unix/generate_localizations.sh b/tools/unix/generate_localizations.sh index 09563b35f6..acc45a6dc9 100755 --- a/tools/unix/generate_localizations.sh +++ b/tools/unix/generate_localizations.sh @@ -1,12 +1,14 @@ #!/bin/bash - set -e -u -x +OMIM_PATH="$(dirname "$0")/../.." +TWINE="$OMIM_PATH/tools/twine/twine" + # TODO: Add "--untagged --tags android" when tags are properly set. # TODO: Add validate-strings-file call to check for duplicates (and avoid Android build errors) when tags are properly set. -./tools/twine/twine --format android generate-all-string-files ./strings.txt ./android/res/ -./tools/twine/twine --format apple generate-all-string-files ./strings.txt ./iphone/Maps/ -./tools/twine/twine --format apple --file-name InfoPlist.strings generate-all-string-files ./iphone/plist.txt ./iphone/Maps/ -./tools/twine/twine --format jquery generate-all-string-files ./data/cuisines.txt ./data/cuisine-strings/ -#./tools/twine/twine --format tizen generate-all-string-files ./strings.txt ./tizen/MapsWithMe/res/ --tags tizen - +$TWINE --format android generate-all-string-files "$OMIM_PATH/strings.txt" "$OMIM_PATH/android/res/" +$TWINE --format apple generate-all-string-files "$OMIM_PATH/strings.txt" "$OMIM_PATH/iphone/Maps/" +$TWINE --format apple --file-name InfoPlist.strings generate-all-string-files "$OMIM_PATH/iphone/plist.txt" "$OMIM_PATH/iphone/Maps/" +$TWINE --format jquery generate-all-string-files "$OMIM_PATH/data/cuisines.txt" "$OMIM_PATH/data/cuisine-strings/" +$TWINE --format jquery generate-all-string-files "$OMIM_PATH/data/countries_names.txt" "$OMIM_PATH/data/countries-strings/" +#$TWINE --format tizen generate-all-string-files "$OMIM_PATH/strings.txt" "$OMIM_PATH/tizen/MapsWithMe/res/" --tags tizen