Bug#1066887: ENhance Patch for local-gen
On 2024-04-09 23:49, Aurelien Jarno wrote: Hi, On 2024-03-15 16:13, M. Buecher wrote: Adding / back to end of the path, so that a locale file is immediately found. diff --git a/debian/local/usr_sbin/locale-gen b/debian/local/usr_sbin/locale-gen index 7fa3d772..1711a4f0 100755 --- a/debian/local/usr_sbin/locale-gen +++ b/debian/local/usr_sbin/locale-gen @@ -23,6 +23,12 @@ is_entry_ok() { fi } +if [ -z "${I18NPATH:-}" ]; then + if [ -d "${USER_LOCALES}" ]; then +I18NPATH="${USER_LOCALES%%/locales*}/" + fi +fi + echo "Generating locales (this might take a while)..." while read -r locale charset; do if [ -z "$locale" ] || [ "${locale#\#}" != "$locale" ]; then continue; fi @@ -46,7 +52,7 @@ while read -r locale charset; do input="$USER_LOCALES/$input" fi fi - localedef -i "$input" -c -f "$charset" -A /usr/share/locale/locale.alias "$locale" || : + I18NPATH="${I18NPATH}" localedef -i "$input" -c -f "$charset" -A /usr/share/locale/locale.alias "$locale" || : echo " done" done < "$LOCALEGEN" echo "Generation complete." Thanks for your bug report and for even proposing a patch which looks good to me. That said as I18NPATH could actually contains a list of directory, I wonder if the behaviour would be more consistent if the user locales directory is always prepended to I18NPATH if it exists. What do you think? Regards Aurelien My thought was: if someone already specified I18NPATH explicitly, then he knows what he is doing and the script should not mess with his setup. Maddes
Bug#1066887: ENhance Patch for local-gen
Hi, On 2024-03-15 16:13, M. Buecher wrote: > Adding / back to end of the path, so that a locale file is immediately > found. > diff --git a/debian/local/usr_sbin/locale-gen > b/debian/local/usr_sbin/locale-gen > index 7fa3d772..1711a4f0 100755 > --- a/debian/local/usr_sbin/locale-gen > +++ b/debian/local/usr_sbin/locale-gen > @@ -23,6 +23,12 @@ is_entry_ok() { > fi > } > > +if [ -z "${I18NPATH:-}" ]; then > + if [ -d "${USER_LOCALES}" ]; then > +I18NPATH="${USER_LOCALES%%/locales*}/" > + fi > +fi > + > echo "Generating locales (this might take a while)..." > while read -r locale charset; do > if [ -z "$locale" ] || [ "${locale#\#}" != "$locale" ]; then continue; > fi > @@ -46,7 +52,7 @@ while read -r locale charset; do > input="$USER_LOCALES/$input" > fi > fi > - localedef -i "$input" -c -f "$charset" -A > /usr/share/locale/locale.alias "$locale" || : > + I18NPATH="${I18NPATH}" localedef -i "$input" -c -f "$charset" -A > /usr/share/locale/locale.alias "$locale" || : > echo " done" > done < "$LOCALEGEN" > echo "Generation complete." Thanks for your bug report and for even proposing a patch which looks good to me. That said as I18NPATH could actually contains a list of directory, I wonder if the behaviour would be more consistent if the user locales directory is always prepended to I18NPATH if it exists. What do you think? Regards Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurel...@aurel32.net http://aurel32.net
Bug#1066887: ENhance Patch for local-gen
Adding / back to end of the path, so that a locale file is immediately found. diff --git a/debian/local/usr_sbin/locale-gen b/debian/local/usr_sbin/locale-gen index 7fa3d772..1711a4f0 100755 --- a/debian/local/usr_sbin/locale-gen +++ b/debian/local/usr_sbin/locale-gen @@ -23,6 +23,12 @@ is_entry_ok() { fi } +if [ -z "${I18NPATH:-}" ]; then + if [ -d "${USER_LOCALES}" ]; then +I18NPATH="${USER_LOCALES%%/locales*}/" + fi +fi + echo "Generating locales (this might take a while)..." while read -r locale charset; do if [ -z "$locale" ] || [ "${locale#\#}" != "$locale" ]; then continue; fi @@ -46,7 +52,7 @@ while read -r locale charset; do input="$USER_LOCALES/$input" fi fi - localedef -i "$input" -c -f "$charset" -A /usr/share/locale/locale.alias "$locale" || : + I18NPATH="${I18NPATH}" localedef -i "$input" -c -f "$charset" -A /usr/share/locale/locale.alias "$locale" || : echo " done" done < "$LOCALEGEN" echo "Generation complete."