MOBILE-3752 lang: Minor fixes on langindex

main
Pau Ferrer Ocaña 2021-05-13 12:55:30 +02:00
parent 9c2a235745
commit 79d3c081ff
2 changed files with 14 additions and 4 deletions

View File

@ -310,7 +310,7 @@ function array_contains {
print_title 'Generating language from code...'
gulp lang
npx gulp lang
print_title 'Getting languages'

View File

@ -10,8 +10,9 @@ DEFAULT_LASTVERSION='4.0'
# Checks if AWS is available and configured.
function check_aws {
aws --version &> /dev/null
AWS_SERVICE=1
aws --version &> /dev/null
if [ $? -ne 0 ]; then
AWS_SERVICE=0
echo 'AWS not installed. Check https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html for more info.'
@ -19,7 +20,7 @@ function check_aws {
fi
# In order to login to AWS, use credentials file or AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY vars.
if [ ! -f ~/.aws/credentials ] && [ [ -z $AWS_ACCESS_KEY_ID ] || [ -z $AWS_SECRET_ACCESS_KEY ] ]; then
if [ ! -f ~/.aws/credentials ] && ([ -z "$AWS_ACCESS_KEY_ID" ] || [ -z "$AWS_SECRET_ACCESS_KEY" ]); then
AWS_SERVICE=0
lastversion=$DEFAULT_LASTVERSION
echo 'AWS Cannot authenticate. Use aws configure or set the proper env vars.'
@ -63,6 +64,13 @@ function get_last_version {
lastversion=$DEFAULT_LASTVERSION
}
# Create langfolder
function create_langfolder {
if [ ! -d $LANGPACKSFOLDER ]; then
mkdir $LANGPACKSFOLDER
fi
}
# Get all language list from AWS.
function get_all_languages_aws {
langsfiles=`aws s3 ls s3://$BUCKET/$lastversion/`
@ -87,6 +95,8 @@ function get_language {
get_last_version
create_langfolder
echo "Getting $lang language"
pushd $LANGPACKSFOLDER > /dev/null
@ -115,7 +125,7 @@ function get_languages {
return
fi
else
mkdir $LANGPACKSFOLDER
create_langfolder
fi