Skip to content

Commit

Permalink
new label: firefoxpkg_intl
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptingosx committed Feb 10, 2023
2 parents 90efb50 + 1f0cc9f commit 1da7d9a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions fragments/labels/firefoxpkg_intl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ firefoxpkg_intl)
# and install corrosponding version of Firefox ESR
name="Firefox"
type="pkg"
userLanguage=$(runAsUser defaults read .GlobalPreferences AppleLocale)
userLanguage=$(runAsUser defaults read .GlobalPreferences AppleLocale | tr '_' '-')
# userLanguage="sv-SE" #for tests without international language setup
printlog "Found language $userLanguage to be used for Firefox." WARN
if ! curl -fs "https://ftp.mozilla.org/pub/firefox/releases/latest/README.txt" | grep -o "=$userLanguage"; then
userLanguage=$(echo $userLanguage | cut -c 1-2)
if ! curl -fs "https://ftp.mozilla.org/pub/firefox/releases/latest/README.txt" | grep "=$userLanguage"; then
userLanguage="en_US"
releaseURL="https://ftp.mozilla.org/pub/firefox/releases/latest/README.txt"
until curl -fs $releaseURL | grep -q "=$userLanguage"; do
if [ ${#userLanguage} -eq 2 ]; then
break
fi
fi
printlog "No locale matching '$userLanguage', trying '${userLanguage:0:2}'"
userLanguage=${userLanguage:0:2}
done
printlog "Using language $userLanguage for download." WARN
downloadURL="https://download.mozilla.org/?product=firefox-pkg-latest-ssl&os=osx&lang=$userLanguage"
# https://download.mozilla.org/?product=firefox-pkg-latest-ssl&os=osx&lang=en-US
Expand Down

0 comments on commit 1da7d9a

Please sign in to comment.