From 69652a51f584af183b99121ef50934b9b9c76fb7 Mon Sep 17 00:00:00 2001 From: michelleb-stripe <77996191+michelleb-stripe@users.noreply.github.com> Date: Wed, 21 Jul 2021 16:46:45 -0700 Subject: [PATCH] Update the localization script instructions. (#4039) --- scripts/find_localize_key_for_value_regex.sh | 9 ++++++++ scripts/localize.sh | 24 ++++++++++++-------- scripts/no_file_assigned.sh | 17 ++++++++++---- scripts/untranslated_project_keys.sh | 18 +++++++++++---- 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/scripts/find_localize_key_for_value_regex.sh b/scripts/find_localize_key_for_value_regex.sh index ee00addbcf4..e3c6b670dc1 100755 --- a/scripts/find_localize_key_for_value_regex.sh +++ b/scripts/find_localize_key_for_value_regex.sh @@ -1,6 +1,15 @@ #!/bin/bash + # This script will do a regular expression match to find the string value in the ios or # android projects, regardless of the translation status +# +# The script can be run as ./find_localize_key_for_value_regex.sh +# For instance: ./find_localize_key_for_value_regex.sh ".*optional.*" + +if [ -z "$API_TOKEN" ]; then + echo "You need to add the API_TOKEN to: localization_vars.sh" + exit +fi echo "Searching for string value: $1" diff --git a/scripts/localize.sh b/scripts/localize.sh index 97aac4f4e6c..11a8a114eb7 100755 --- a/scripts/localize.sh +++ b/scripts/localize.sh @@ -1,17 +1,21 @@ #!/bin/bash - -#This script will pull down the strings for each of the modules and copies -#them into the respective string directories. +# This script will pull down the strings for each of the modules and copies +# them into the respective string directories. +# +# It will remove the android directory from which it works at the beginning +# It will not replace the default string value. +# It will do iso renames as needed. +# It will not perform a commit. # -#It will remove the android directory from which it works at the beginning -#It will not replace the default string value. -#It will do iso renames as needed. -#It will not perform a commit. +# It does generate an android/$MODULE-strings.xml file for use by other scripts. # -#It does generate an android/$MODULE-strings.xml file for use by other scripts. +# This script can be run with no arguments: +# ./localize.sh -#xml is for android, strings is for iOS -FORMAT=xml +if [ -z "$API_TOKEN" ]; then + echo "You need to add the API_TOKEN to: localization_vars.sh" + exit +fi if [[ -z $(which lokalise2) ]]; then echo "Installing lokalise2 via homebrew..." diff --git a/scripts/no_file_assigned.sh b/scripts/no_file_assigned.sh index bc2afa9e036..ee2bd946d9d 100755 --- a/scripts/no_file_assigned.sh +++ b/scripts/no_file_assigned.sh @@ -1,8 +1,17 @@ #!/bin/bash - -#This will download all the android files, and strings that are assigned to android -#but not to any files will be outputted. This indicates an error. It will cleanup -#files created at the end. +# This will download all the android files, and strings that are assigned to android +# but not to any files will be outputted. This indicates an error. It will cleanup +# files created at the end. +# +# This will not replace any files in the android project. +# +# This script can be run with no arguments: +# ./no_file_assigned.sh + +if [ -z "$API_TOKEN" ]; then + echo "You need to add the API_TOKEN to: localization_vars.sh" + exit +fi if [[ -z $(which lokalise2) ]]; then echo "Installing lokalise2 via homebrew..." diff --git a/scripts/untranslated_project_keys.sh b/scripts/untranslated_project_keys.sh index 0023c882c1f..61cdf6823d4 100755 --- a/scripts/untranslated_project_keys.sh +++ b/scripts/untranslated_project_keys.sh @@ -1,10 +1,18 @@ #!/bin/bash -#This script will go through each of the modules and verify that each string key is -#associated with android in localize. If it isn't the script will search for the string -#value in the localize android and ios project. +# This script will go through each of the modules and verify that each string key is +# associated with android in localize. If it isn't the script will search for the string +# value in the localize android and ios project. # -# It will ignore strings in the project that have the translateable=false +# This script requires that localize.sh is run first, if it is not it will exit with an error. +# +# This script can be run with no arguments: +# ./untranslated_project_key.sh + +if [ -z "$API_TOKEN" ]; then + echo "You need to add the API_TOKEN to: localization_vars.sh" + exit +fi if [[ -z $(which lokalise2) ]]; then echo "Installing lokalise2 via homebrew..." @@ -34,7 +42,7 @@ do sort -o android/$MODULE-localize_android_keys-sorted.txt android/$MODULE-localize_android_keys.txt # List all the keys in the android project. - cat ../$MODULE/res/values/strings.xml | grep -v "translatable=\"false\"" | gsed -E -n "s/\s*(.*)<\/string>/\1/pI" > android/$MODULE-project_keys.txt + cat ../$MODULE/res/values/strings.xml | gsed -E -n "s/\s*(.*)<\/string>/\1/pI" > android/$MODULE-project_keys.txt sort -o android/$MODULE-project_keys-sorted.txt android/$MODULE-project_keys.txt diff -u android/$MODULE-localize_android_keys-sorted.txt android/$MODULE-project_keys-sorted.txt | grep -E "^[\+][a-z]" | sed 's/^+//g' > android/diff_keys-$MODULE.txt