Skip to content
Snippets Groups Projects
Commit 8f2286c2 authored by Robert Lange's avatar Robert Lange
Browse files

Merge branch 'finc' into instance/fid

parents da2a6a85 ccd05c6d
No related merge requests found
...@@ -20,14 +20,34 @@ ...@@ -20,14 +20,34 @@
# this script merges token files and removes unused / duplicate tokens with parent and target translation file *.ini # this script merges token files and removes unused / duplicate tokens with parent and target translation file *.ini
# assumes You are in projects base dir # assumes You are in projects base dir
# if new translations are on alpha, first copy files via:
# scp -r [user]@139.18.19.237:/usr/local/vufind/[instance]/[issue_number]/data/i18n/languages /[path_to_instance_directory]/data/i18n/languages
Help()
{
# Display Help
echo "Usage: $0 path/to/language/with/new/tokens path/to/language/file/of/instance [path/to/parent/file/of/instance]"
echo "example command 1: \"devops/i18n-merge.sh data/i18n/languages/de.ini de_zi4/languages/de.ini local/languages/de.ini\"";
echo "if new translations are on alpha, first copy files via: scp -r [user]@139.18.19.237:/usr/local/vufind/[instance]/[issue_number]/data/i18n/languages /[path_to_instance_directory]/data/i18n/languages"
}
while getopts ":h" option; do
case $option in
h) # display Help
Help
exit;;
\?) # incorrect option
echo "Error: Invalid option"
exit 1;
esac
done
CACHE_FILE=$1; INSTANCE_FILE=$2; PARENT_FILE=$3; CACHE_FILE=$1; INSTANCE_FILE=$2; PARENT_FILE=$3;
HAS_ERROR=0; HAS_ERROR=0;
if [ -z "$CACHE_FILE" ] || [ -z "$INSTANCE_FILE" ]; then if [ -z "$CACHE_FILE" ] || [ -z "$INSTANCE_FILE" ]; then
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" Help
HAS_ERROR=1 exit 1;
echo "Usage: $0 path/to/language/with/new/tokens path/to/language/file/of/instance [path/to/parent/file/of/instance]"
echo "example command 1: \"devops/i18n-merge.sh data/i18n/languages/de.ini de_zi4/languages/de.ini local/languages/de.ini\"";
else else
if [ ! -f "$CACHE_FILE" ] if [ ! -f "$CACHE_FILE" ]
then then
...@@ -38,6 +58,12 @@ else ...@@ -38,6 +58,12 @@ else
then then
echo "Language File "$INSTANCE_FILE" does not exist on your filesystem."; HAS_ERROR=1; echo "Language File "$INSTANCE_FILE" does not exist on your filesystem."; HAS_ERROR=1;
fi fi
if [ ${CACHE_FILE##*/} != ${INSTANCE_FILE##*/} ]
then
echo "Cache file "$CACHE_FILE" and language file "$INSTANCE_FILE" must have same file name.";
HAS_ERROR=1;
fi
fi fi
if [ -z "$CACHE_FILE" ]; then if [ -z "$CACHE_FILE" ]; then
...@@ -45,11 +71,21 @@ if [ -z "$CACHE_FILE" ]; then ...@@ -45,11 +71,21 @@ if [ -z "$CACHE_FILE" ]; then
echo "Parent Language File "$PARENT_FILE" does not exist on your filesystem."; echo "Parent Language File "$PARENT_FILE" does not exist on your filesystem.";
HAS_ERROR=1; HAS_ERROR=1;
fi fi
if [ ${CACHE_FILE##*/} != ${PARENT_FILE##*/} ]; then
echo "Cache file "$CACHE_FILE" and parent file "$PARENT_FILE" must have same file name.";
HAS_ERROR=1;
fi
fi
if [ ! -z "$PARENT_FILE" ]; then
if [ ${INSTANCE_FILE##*/} != ${PARENT_FILE##*/} ]; then
echo "Instance file "$INSTANCE_FILE" and parent file "$PARENT_FILE" must have same file name.";
HAS_ERROR=1;
fi
fi fi
if [ $HAS_ERROR = 1 ] if [ $HAS_ERROR = 1 ]
then then
#echo "exit 1: aborting"
exit 1; exit 1;
fi fi
...@@ -58,10 +94,12 @@ declare -A newTokens ...@@ -58,10 +94,12 @@ declare -A newTokens
declare -a newTokensOrder declare -a newTokensOrder
while IFS= read -r line || [ -n "$line" ] # handle possible missing newline in last line while IFS= read -r line || [ -n "$line" ] # handle possible missing newline in last line
do do
key=$(echo "$line" | awk -F: '{ st = index($0,"=");print substr($0,0,st-1)}') if [ ! -z "$line" ]; then # ignore empty lines
value=$(echo "$line" | awk -F: '{ st = index($0,"=");print substr($0,st+1)}') key=$(echo "$line" | awk -F: '{ st = index($0,"=");print substr($0,0,st-1)}')
newTokens["$key"]="$value" value=$(echo "$line" | awk -F: '{ st = index($0,"=");print substr($0,st+1)}')
newTokensOrder+=("$key"); newTokens["$key"]="$value"
newTokensOrder+=("$key");
fi
done < $CACHE_FILE done < $CACHE_FILE
echo "Reading and minify existing tokens from $INSTANCE_FILE" echo "Reading and minify existing tokens from $INSTANCE_FILE"
......
...@@ -133,7 +133,6 @@ Author = Author ...@@ -133,7 +133,6 @@ Author = Author
ISN = "ISBN/ISSN" ISN = "ISBN/ISSN"
Signatur = "Call Number" Signatur = "Call Number"
Barcode = Barcode Barcode = Barcode
tag = Tag
; This section defines which search options will be included on the advanced ; This section defines which search options will be included on the advanced
; search screen. All the notes above [Basic_Searches] also apply here. ; search screen. All the notes above [Basic_Searches] also apply here.
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment