Fix userguide localization

Change-Id: Ie52a545b4e50ef3d87c7bfb26e54772fd7816377
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5974
Reviewed-by: nephele <nep@packageloss.eu>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
This commit is contained in:
Pascal Abresch 2022-12-30 15:48:34 +01:00 committed by Adrien Destugues
parent 281ece0b8a
commit 99d1318ec0
3 changed files with 32 additions and 14 deletions

View File

@ -1,13 +1,19 @@
#!/bin/sh #!/bin/sh
language=$(locale -l)
# The locale can be a single 2 char language or in severall segments like en, se_SE or sr_Latn_ME
# this tries to get the 2 char language code from longer locales as a fallback
languageBase=$(echo $language | awk -F_ '{print $1}')
welcomeURL="\ welcomeURL="\
https://www.haiku-os.org/docs/welcome/welcome_en.html" https://www.haiku-os.org/docs/welcome/welcome_en.html"
welcomeDir=/boot/system/documentation/welcome/ welcomeFile=/boot/system/documentation/welcome/welcome_en.html
welcomeFile=$welcomeDir/welcome_en.html localizedWelcomeFile=/boot/system/documentation/welcome/welcome_"$language".html
localizedWelcomeFile=$welcomeDir/welcome_"$LANG".html localizedWelcomeFileBase=/boot/system/documentation/welcome/welcome_"$languageBase".html
if [ -f $localizedWelcomeFile ]; then if [ -f $localizedWelcomeFile ]; then
open file://$localizedWelcomeFile open file:$localizedWelcomeFile
elif [ -f $localizedWelcomeFileBase ]; then
open file:$localizedWelcomeFileBase
elif [ -f $welcomeFile ]; then elif [ -f $welcomeFile ]; then
open $welcomeFile open $welcomeFile
else else

View File

@ -1,16 +1,21 @@
#!/bin/sh #!/bin/sh
language=$(locale -l)
# The locale can be a single 2 char language or in severall segments like en, se_SE or sr_Latn_ME
# this tries to get the 2 char language code from longer locales as a fallback
languageBase=$(echo $language | awk -F_ '{print $1}')
quicktourURL="\ quicktourURL="\
https://www.haiku-os.org/docs/welcome/en/quicktour.html" https://www.haiku-os.org/docs/welcome/en/quicktour.html"
quicktourDir=/boot/system/documentation/welcome/en/ quicktour=/boot/system/documentation/welcome/en/quicktour.html
quicktourFile=$quicktourDir/quicktour.html localizedQuicktour=/boot/system/documentation/welcome/"$language"/quicktour.html
localizedQuicktourDir=/boot/system/documentation/welcome/"$LANG"/ localizedQuicktourBase=/boot/system/documentation/welcome/"$languageBase"/quicktour.html
localizedQuicktourFile=$localizedQuicktourDir/quicktour.html
if [ -f $localizedQuicktourFile ]; then if [ -f $localizedQuicktour ]; then
open file://$localizedQuicktourFile open file:$localizedQuicktour
elif [ -f $quicktourFile ]; then elif [ -f $localizedQuicktourBase ];
open $quicktourFile open file:$localizedQuicktourBase
elif [ -f $quicktour ]; then
open $quicktour
else else
open $quicktourURL open $quicktourURL
fi fi

View File

@ -1,13 +1,20 @@
#!/bin/bash #!/bin/bash
language=$(locale -l)
# The locale can be a single 2 char language or in severall segments like en, se_SE or sr_Latn_ME
# this tries to get the 2 char language code from longer locales as a fallback
languageBase=$(echo $language | awk -F_ '{print $1}')
userGuideURL="\ userGuideURL="\
https://www.haiku-os.org/docs/userguide/en/contents.html" https://www.haiku-os.org/docs/userguide/en/contents.html"
userGuideDir=/boot/system/documentation/userguide/ userGuideDir=/boot/system/documentation/userguide/
userGuide=$userGuideDir/en/contents.html userGuide=$userGuideDir/en/contents.html
localizedUserGuide=$userGuideDir/"$LANG"/contents.html localizedUserGuide=$userGuideDir/"$language"/contents.html
localizedUserGuideBase=$userGuideDir/"$languageBase"/contents.html
if [ -f $localizedUserGuide ]; then if [ -f $localizedUserGuide ]; then
open file://$localizedUserGuide open file:$localizedUserGuide
elif [ -f $localizedUserGuideBase ]; then
open file:$localizedUserGuideBase
elif [ -f $userGuide ]; then elif [ -f $userGuide ]; then
open $userGuide open $userGuide
else else