From 4cb3a60a348b5362927bf5225d1c1367d461d401 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 26 Jul 2018 23:29:40 +0200 Subject: Imrpoved locatliztion variable names with underscore --- subprojects/freeamo/freeamo | 28 +++++++++++++------------- subprojects/freeamo/src/get-licenses | 2 -- subprojects/freeamo/src/main_functions | 24 +++++++++++----------- subprojects/freeamo/src/make-wiki | 4 ++-- subprojects/freeamo/src/unmaintained/bad_names | 10 --------- 5 files changed, 28 insertions(+), 40 deletions(-) diff --git a/subprojects/freeamo/freeamo b/subprojects/freeamo/freeamo index ac4d7c7..7bcab33 100755 --- a/subprojects/freeamo/freeamo +++ b/subprojects/freeamo/freeamo @@ -68,27 +68,27 @@ case "$1" in ""|--debug|--normal-mode) - freeamo_command="$0 --conf-note $debug_arg" + freeamo_command="$0 --conf-note $debug_arg" echo "$freeamo_command"; $freeamo_command - freeamo_command="$0 --remove-build $debug_arg" + freeamo_command="$0 --remove-build $debug_arg" echo "$freeamo_command"; $freeamo_command - freeamo_command="$0 --conf-copy $debug_arg" + freeamo_command="$0 --conf-copy $debug_arg" echo "$freeamo_command"; $freeamo_command - freeamo_command="$0 --search-pages $debug_arg" + freeamo_command="$0 --search-pages $debug_arg" echo "$freeamo_command"; $freeamo_command - freeamo_command="$0 --get-licenses $debug_arg" + freeamo_command="$0 --get-licenses $debug_arg" echo "$freeamo_command"; $freeamo_command - freeamo_command="$0 --get-add-ons $debug_arg" + freeamo_command="$0 --get-add-ons $debug_arg" echo "$freeamo_command"; $freeamo_command if [ ! "$1" == "--normal-mode" ]; then - freeamo_command="$0 --make-directory.fsf.org-wiki $debug_arg" + freeamo_command="$0 --make-directory.fsf.org-wiki $debug_arg" echo "$freeamo_command"; $freeamo_command fi @@ -113,7 +113,7 @@ f.org-wiki (they are used by Free Software Directory developers) The licenses are not added to the general JSON file. This option will download the neccesary license JSON files for all add-ons. $0 --get-add-ons Download the installable add-ons (the .xpi files). - $0 --make-directory.fsf.org-wiki + $0 --make-directory.fsf.org-wiki Generates .wiki files specifically for https://directory.fsf.org/wiki/ Disabled options due to limited development time @@ -159,10 +159,10 @@ Disabled options due to limited development time --search-pages) # This option is named after named after https://addons.mozilla.org/en-US/firefox/search/ - freeamo_command="$0 --search-pages--download $debug_arg" + freeamo_command="$0 --search-pages--download $debug_arg" echo "$freeamo_command"; $freeamo_command - freeamo_command="$0 --search-pages--filter $debug_arg" + freeamo_command="$0 --search-pages--filter $debug_arg" echo "$freeamo_command"; $freeamo_command ;; @@ -185,10 +185,10 @@ Disabled options due to limited development time --get-licenses) - freeamo_command="$0 --get-licenses--download $debug_arg" + freeamo_command="$0 --get-licenses--download $debug_arg" echo "$freeamo_command"; $freeamo_command - freeamo_command="$0 --get-licenses--filter $debug_arg" + freeamo_command="$0 --get-licenses--filter $debug_arg" echo "$freeamo_command"; $freeamo_command ;; @@ -210,10 +210,10 @@ Disabled options due to limited development time --get-add-ons) - freeamo_command="$0 --get-add-ons--download $debug_arg" + freeamo_command="$0 --get-add-ons--download $debug_arg" echo "$freeamo_command"; $freeamo_command - freeamo_command="$0 --get-add-ons--filter $debug_arg" + freeamo_command="$0 --get-add-ons--filter $debug_arg" echo "$freeamo_command"; $freeamo_command ;; diff --git a/subprojects/freeamo/src/get-licenses b/subprojects/freeamo/src/get-licenses index 6f43518..7e587b4 100644 --- a/subprojects/freeamo/src/get-licenses +++ b/subprojects/freeamo/src/get-licenses @@ -101,8 +101,6 @@ function get-licenses--filter { source "$run_path/src/main_functions" amo_variables amo_variables__licenses - - # license="$(jq ".license.name" "$run_path/build/json/current_versions/$current_version__id.json" | sed "s|en-US|enUS|;" | jq -r .enUS )" # echo "$run_path/build/json/current_versions/$(jq ".results[$entry].current_version.id" "$file")" diff --git a/subprojects/freeamo/src/main_functions b/subprojects/freeamo/src/main_functions index 06ddad6..88de297 100644 --- a/subprojects/freeamo/src/main_functions +++ b/subprojects/freeamo/src/main_functions @@ -65,8 +65,8 @@ function do-locale { echo "####################" - tmp__enUS=$(jq ".results[$entry].$locale_description" "$file" | sed "s|-||;" | jq -r .enUS ) - tmp__enGB=$(jq ".results[$entry].$locale_description" "$file" | sed "s|-||;" | jq -r .enGB ) + tmp__en_US=$(jq ".results[$entry].$locale_description" "$file" | sed "s|en-US|en_US|" | jq -r .en_US ) + tmp__en_GB=$(jq ".results[$entry].$locale_description" "$file" | sed "s|en-GB|en_GB|" | jq -r .en_GB ) # Use the first avalible if English is not avaliable tmp=$(jq -r ".results[$entry].$locale_description[]" "$file" | head -n 1) || [[ $? == 141 ]] # jq causes superfluous 141 @@ -75,40 +75,40 @@ echo "####################" # if [ "$tmp" == "" ]; then # # # Some entries doesn't provide any `description` field but only a `summary` field. -# tmp=$(jq ".results[$entry].summary[]" "$file" | head -n 1 | sed "s|-||;"); +# tmp=$(jq ".results[$entry].summary[]" "$file" | head -n 1 | sed "s|-|_|"); # #fi - if [ "$tmp__enUS" != "null" ]; then + if [ "$tmp__en_US" != "null" ]; then if [ "$locale_description" == "name" ]; then - name="$tmp__enUS"; + name="$tmp__en_US"; elif [ "$locale_description" == "summary" ]; then - summary="$tmp__enUS"; + summary="$tmp__en_US"; elif [ "$locale_description" == "description" ]; then - description="$tmp__enUS"; + description="$tmp__en_US"; fi - elif [ "$tmp__enGB" != "null" ]; then + elif [ "$tmp__en_GB" != "null" ]; then if [ "$locale_description" == "name" ]; then - name="$tmp__enGB"; + name="$tmp__en_GB"; elif [ "$locale_description" == "summary" ]; then - summary="$tmp__enGB"; + summary="$tmp__en_GB"; elif [ "$locale_description" == "description" ]; then - description="$tmp__enGB"; + description="$tmp__en_GB"; fi @@ -163,7 +163,7 @@ function amo_variables() { function amo_variables__licenses { - license__amo_full_name="$(jq ".license.name" "$run_path/build/json/current_versions/$current_version__id.json" | sed "s|en-US|enUS|;" | jq -r .enUS)" + license__amo_full_name="$(jq ".license.name" "$run_path/build/json/current_versions/$current_version__id.json" | sed "s|en-US|en_US|;" | jq -r .en_US)" } diff --git a/subprojects/freeamo/src/make-wiki b/subprojects/freeamo/src/make-wiki index 3b7019b..784a7a4 100644 --- a/subprojects/freeamo/src/make-wiki +++ b/subprojects/freeamo/src/make-wiki @@ -83,7 +83,7 @@ while IFS= read -r table; do # End description code # The homepage field is mandatory so let's remove "null" from it because we don't need to evaluat it - homepage_url=$(jq .results[$entry].homepage "$file" | sed "s|en-US|enUS|;" | jq -r .enUS | sed "s|null||"); + homepage_url=$(jq .results[$entry].homepage "$file" | sed "s|en-US|en_US|;" | jq -r .en_US | sed "s|null||"); license_copyright=$(jq -r .results[$entry].authors[].name "$file" ); bayesian_average=$(jq .results[$entry].ratings.bayesian_average "$file"); bayesian_average__simple=$(printf "%.1f" "${bayesian_average//./,}"); @@ -137,7 +137,7 @@ while IFS= read -r table; do fi - support_url=$(jq .results[$entry].support_url "$file" | sed "s|en-US|enUS|;" | jq -r .enUS); + support_url=$(jq .results[$entry].support_url "$file" | sed "s|en-US|en_US|;" | jq -r .en_US); last_updated=$(jq -r .results[$entry].last_updated $file | sed "s|T|\n|" | head -n 1 | sed "s|-|/|g"); # List JSON structure: cat json/$file | js '.' diff --git a/subprojects/freeamo/src/unmaintained/bad_names b/subprojects/freeamo/src/unmaintained/bad_names index c55cb34..d919a00 100644 --- a/subprojects/freeamo/src/unmaintained/bad_names +++ b/subprojects/freeamo/src/unmaintained/bad_names @@ -1,15 +1,5 @@ - - function search-pages--filter__bad_names() { -name=$(jq .results[$entry].name "$run_path/build/json/$file" | sed "s|en-US|enUS|;" | jq -r .enUS); - -if [ "$name" == "null" ]; then - -name=$(jq .results[$entry].name "$run_path/build/json/$file" | sed "s|en-GB|enGB|;" | jq -r .enGB); - -fi - # The API `name` parameter makes bad MediaWiki URL's - https://github.com/mozilla/addons-server/issues/8790 # Clean titles. Example of bad titles: "Ghostery – Privacy Ad Blocker" -- cgit v1.2.3