Skip to content

Commit 1429e12

Browse files
committed
Adding review comments
- L14 setting a default value for SCENARIOS - L21 variable quotation - L21-L53 reworking the logic to choose translations files based on locale passed to the script
1 parent 473e148 commit 1429e12

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

scripts/install_from_release.sh

+28-26
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,46 @@ if [ "$RELEASE" == "" ]; then
1010
RELEASE="latest"
1111
fi
1212

13+
# Set a default scenarios file
14+
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/scenarios.zip"
15+
1316
# Map the language parameter to the corresponding scenarios file
1417
# If no parameter, download the scenarios from IE
1518
MAIN_LANG_PREFIX="$(echo "$LANG" | head -c2 | tr '[:upper:]' '[:lower:]')"
16-
LANG_ARRAY_1=("de" "es" "fr" "it" "nl" "pt")
17-
LANG_ARRAY_2=("cs" "hu" "id" "ja" "ko" "pl" "pt" "ru" "sv" "tr")
19+
LANG_ARRAY=("de" "es" "fr" "it" "nl" "pt" "zh" "cs" "hu" "id" "ja" "ko" "pl" "pt" "ru" "sv" "tr")
1820

19-
if [ "$MAIN_LANG_PREFIX" = "" ] || [ "$MAIN_LANG_PREFIX" = "en" ]; then
20-
SCENARIOS="https://github.com/Azure/InnovationEngine/releases/download/$RELEASE/scenarios.zip"
21-
elif [ "$MAIN_LANG_PREFIX" = "pt" ]; then
22-
if [ "$LANG" = 'pt-pt' ]; then
23-
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/pt-pt-scenarios.zip"
24-
elif [ "$LANG" = 'pt-br' ]; then
25-
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/pt-br-scenarios.zip"
21+
if [[ "${LANG_ARRAY[*]}" =~ "$MAIN_LANG_PREFIX" ]]; then
22+
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-$MAIN_LANG_PREFIX-scenarios.zip"
23+
if [ "$MAIN_LANG_PREFIX" = "pt" ]; then
24+
if [ "$LANG" = "pt-pt" ]; then
25+
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/pt-pt-scenarios.zip"
26+
elif [ "$LANG" = "pt-br" ]; then
27+
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/pt-br-scenarios.zip"
28+
else
29+
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/pt-pt-scenarios.zip"
30+
fi
2631
fi
27-
elif [ "$MAIN_LANG_PREFIX" = "zh" ]; then
28-
if [ "$LANG" = "zh-cn" ]; then
29-
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-cn-scenarios.zip"
30-
elif [ "$LANG" = "zh-tw" ]; then
31-
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-tw-scenarios.zip"
32-
else
33-
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-cn-scenarios.zip"
32+
if [ "$MAIN_LANG_PREFIX" = "zh" ]; then
33+
if [ "$LANG" = "zh-cn" ]; then
34+
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-cn-scenarios.zip"
35+
elif [ "$LANG" = "zh-tw" ]; then
36+
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-tw-scenarios.zip"
37+
else
38+
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/zh-cn-scenarios.zip"
39+
fi
3440
fi
35-
elif [[ ${LANG_ARRAY_1[@]} =~ $MAIN_LANG_PREFIX ]]; then
36-
# for any other language that we do not have a specific scenarios file for, we will use the generic one
37-
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-$MAIN_LANG_PREFIX-scenarios.zip"
38-
elif [[ ${LANG_ARRAY_2[@]} =~ $MAIN_LANG_PREFIX ]]; then
39-
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-$MAIN_LANG_PREFIX-scenarios.zip"
4041
if [ "$MAIN_LANG_PREFIX" = "cs" ]; then
4142
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-cz-scenarios.zip"
42-
elif [ "$MAIN_LANG_PREFIX" = "ja" ]; then
43+
fi
44+
if [ "$MAIN_LANG_PREFIX" = "ja" ]; then
4345
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-jp-scenarios.zip"
44-
elif [ "$MAIN_LANG_PREFIX" = "ko" ]; then
46+
fi
47+
if [ "$MAIN_LANG_PREFIX" = "ko" ]; then
4548
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-kr-scenarios.zip"
46-
elif [ "$MAIN_LANG_PREFIX" = "sv" ]; then
49+
fi
50+
if [ "$MAIN_LANG_PREFIX" = "sv" ]; then
4751
SCENARIOS="https://github.com/MicrosoftDocs/executable-docs/releases/download/v1.0.1/$MAIN_LANG_PREFIX-se-scenarios.zip"
4852
fi
49-
else
50-
SCENARIOS="https://github.com/Azure/InnovationEngine/releases/download/$RELEASE/scenarios.zip"
5153
fi
5254

5355
# Download the binary

0 commit comments

Comments
 (0)