fix hardcoded setfr in main file
This commit is contained in:
12
README.md
12
README.md
@@ -204,7 +204,7 @@ change the default without having to pass flags every time.
|
||||
|
||||
### 4.3. Locale shortcuts
|
||||
|
||||
The `[general]` key `SET_LOCALE` accepts a comma-separated list of
|
||||
The `[lang]` key `SET_LOCALE` accepts a comma-separated list of
|
||||
`alias:locale` pairs. Each pair generates a function of that name at startup:
|
||||
|
||||
```ini
|
||||
@@ -214,6 +214,16 @@ SET_LOCALE = fr:fr_FR.UTF-8, us:en_US.UTF-8
|
||||
This creates `setfr` and `setus`. Use `setlocale <locale>` to switch to any
|
||||
installed locale directly.
|
||||
|
||||
Set `DEFAULT_LANG` to one of the defined aliases to activate that locale
|
||||
automatically at login:
|
||||
|
||||
```ini
|
||||
DEFAULT_LANG = fr
|
||||
```
|
||||
|
||||
If `DEFAULT_LANG` is set but does not match any alias in `SET_LOCALE`, a
|
||||
warning is displayed and no locale change is applied.
|
||||
|
||||
### 4.4. Prompt theming
|
||||
|
||||
The prompt appearance is controlled by two mechanisms that are applied in order
|
||||
|
||||
@@ -89,6 +89,11 @@ TERM=xterm-256color
|
||||
# creates setfr, setus, setes.
|
||||
#SET_LOCALE=fr:fr_FR.UTF-8,us:en_US.UTF-8
|
||||
|
||||
# Alias to activate at login. Must match one of the aliases defined in SET_LOCALE above.
|
||||
# Example: DEFAULT_LANG=fr → calls setfr at startup.
|
||||
# Leave unset to keep the system default locale.
|
||||
#DEFAULT_LANG=fr
|
||||
|
||||
# ==============================================================================
|
||||
[net]
|
||||
# dwl: Force a specific download tool (curl, wget, fetch).
|
||||
|
||||
14
profile.sh
14
profile.sh
@@ -258,8 +258,18 @@ if [[ $INTERACTIVE ]]; then
|
||||
trap 'timer_start' DEBUG
|
||||
PROMPT_COMMAND='set_prompt'
|
||||
|
||||
# Set default language
|
||||
setfr
|
||||
# Set default language from DEFAULT_LANG config key (set in [general]).
|
||||
# The value must match one of the alias names defined in SET_LOCALE so that
|
||||
# the corresponding set<alias> function exists after build_locale_shortcuts.
|
||||
if [[ -n "${DEFAULT_LANG:-}" ]]; then
|
||||
local _lang_fn="set${DEFAULT_LANG}"
|
||||
if declare -F "$_lang_fn" >/dev/null 2>&1; then
|
||||
"$_lang_fn"
|
||||
else
|
||||
disp W "DEFAULT_LANG '$DEFAULT_LANG' has no matching locale shortcut (check SET_LOCALE in profile.conf)."
|
||||
fi
|
||||
unset _lang_fn
|
||||
fi
|
||||
showinfo && printf "\n"
|
||||
check_updates -q
|
||||
disp I "Profile version $PROFVERSION chargé..."
|
||||
|
||||
Reference in New Issue
Block a user