-
-
Notifications
You must be signed in to change notification settings - Fork 422
943 Local Setup - Kept Old US Local Setup In place #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
technicks89
wants to merge
8
commits into
ChrisTitusTech:main
Choose a base branch
from
technicks89:943_Locale_update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+84
−0
Open
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fd7b8d7
Added a locale setup, kept the original US Local Setup in place
technicks89 6ca16bd
Added a few extra locales
technicks89 0083377
Fixed POSIX compliance issue
technicks89 c3c28d3
Fixed Tab_data permissions, Fixed documentation missing space, added …
technicks89 a729863
Commited suggestions from coderabbitai
technicks89 c48f44a
Merge branch 'ChrisTitusTech:main' into 943_Locale_update
technicks89 3ab80bd
Updated to make sure valid locale is entered
technicks89 2793b64
switched to using supported locales based on code rabbit
technicks89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| #!/bin/sh -e | ||
|
|
||
| . ../common-script.sh | ||
| . ../common-service-script.sh | ||
|
|
||
| get_suggested_locale() { | ||
| key="$1" | ||
| default_locale="en_US.UTF-8" | ||
|
|
||
| # Use case statement to map keys to values (POSIX standard) | ||
| case "$key" in | ||
| us) echo "en_US.UTF-8" ;; | ||
| uk) echo "en_GB.UTF-8" ;; | ||
| ca) echo "en_CA.UTF-8" ;; | ||
| cf) echo "fr_CA.UTF-8" ;; | ||
| cn) echo "zh_CN.UTF-8" ;; | ||
| by) echo "be_BY.UTF-8" ;; | ||
| cz) echo "cs_CZ.UTF-8" ;; | ||
| de) echo "de_DE.UTF-8" ;; | ||
| dk) echo "da_DK.UTF-8" ;; | ||
| es) echo "es_ES.UTF-8" ;; | ||
| et) echo "et_EE.UTF-8" ;; | ||
| fa) echo "fa_IR.UTF-8" ;; | ||
| fi) echo "fi_FI.UTF-8" ;; | ||
| fr) echo "fr_FR.UTF-8" ;; | ||
| gr) echo "el_GR.UTF-8" ;; | ||
| hu) echo "hu_HU.UTF-8" ;; | ||
| il) echo "he_IL.UTF-8" ;; | ||
| it) echo "it_IT.UTF-8" ;; | ||
| jp) echo "ja_JP.UTF-8" ;; | ||
| kr) echo "ko_KR.UTF-8" ;; | ||
| lt) echo "lt_LT.UTF-8" ;; | ||
| lv) echo "lv_LV.UTF-8" ;; | ||
| mk) echo "mk_MK.UTF-8" ;; | ||
| nl) echo "nl_NL.UTF-8" ;; | ||
| no) echo "nb_NO.UTF-8" ;; | ||
| ph) echo "en_PH.UTF-8" ;; | ||
| pl) echo "pl_PL.UTF-8" ;; | ||
| ro) echo "ro_RO.UTF-8" ;; | ||
| ru) echo "ru_RU.UTF-8" ;; | ||
| se) echo "sv_SE.UTF-8" ;; | ||
| sg) echo "de_CH.UTF-8" ;; | ||
| si) echo "sl_SI.UTF-8" ;; | ||
| tr) echo "tr_TR.UTF-8" ;; | ||
| ua) echo "uk_UA.UTF-8" ;; | ||
| *) echo "$default_locale" ;; # Default fallback | ||
|
technicks89 marked this conversation as resolved.
Outdated
|
||
| esac | ||
| } | ||
|
|
||
| setLocale() { | ||
| if command_exists locale-gen; then | ||
|
|
||
| iso=$(curl ifconfig.io/country_code | tr '[:upper:]' '[:lower:]') | ||
| suggested_locale=$(get_suggested_locale "$iso") | ||
|
technicks89 marked this conversation as resolved.
Outdated
|
||
|
|
||
| while true; do | ||
| printf "Detected locale: '%s'. Press Enter to accept or type a new one (e.g. de_DE.UTF-8): " "$suggested_locale" | ||
| read -r input | ||
| LOCALE="${input:-$suggested_locale}" | ||
|
|
||
| case "$LOCALE" in | ||
| *_**) | ||
| # Check 2: Must end with .UTF-8 | ||
| if echo "$LOCALE" | grep -qE '\.UTF-8$'; then | ||
| # Found a likely valid locale format | ||
| break | ||
| fi | ||
| ;; | ||
| esac | ||
|
|
||
| # If we reach here, the validation failed | ||
| echo "ERROR! Locale '$LOCALE' does not look valid. Please enter a locale like en_US.UTF-8." | ||
| done | ||
|
|
||
| echo "LC_ALL=${LOCALE}" | "$ESCALATION_TOOL" tee -a /etc/environment | ||
| echo "$LOCALE UTF-8" | "$ESCALATION_TOOL" tee -a /etc/locale.gen | ||
| echo "LANG=$LOCALE" | "$ESCALATION_TOOL" tee -a /etc/locale.conf | ||
| "$ESCALATION_TOOL" locale-gen "$LOCALE" | ||
|
technicks89 marked this conversation as resolved.
Outdated
|
||
| fi | ||
|
technicks89 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| checkEnv | ||
|
technicks89 marked this conversation as resolved.
|
||
| setLocale | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.