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
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="\
https://www.haiku-os.org/docs/welcome/welcome_en.html"
welcomeDir=/boot/system/documentation/welcome/
welcomeFile=$welcomeDir/welcome_en.html
localizedWelcomeFile=$welcomeDir/welcome_"$LANG".html
welcomeFile=/boot/system/documentation/welcome/welcome_en.html
localizedWelcomeFile=/boot/system/documentation/welcome/welcome_"$language".html
localizedWelcomeFileBase=/boot/system/documentation/welcome/welcome_"$languageBase".html
if [ -f $localizedWelcomeFile ]; then
open file://$localizedWelcomeFile
open file:$localizedWelcomeFile
elif [ -f $localizedWelcomeFileBase ]; then
open file:$localizedWelcomeFileBase
elif [ -f $welcomeFile ]; then
open $welcomeFile
else

View File

@ -1,16 +1,21 @@
#!/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="\
https://www.haiku-os.org/docs/welcome/en/quicktour.html"
quicktourDir=/boot/system/documentation/welcome/en/
quicktourFile=$quicktourDir/quicktour.html
localizedQuicktourDir=/boot/system/documentation/welcome/"$LANG"/
localizedQuicktourFile=$localizedQuicktourDir/quicktour.html
quicktour=/boot/system/documentation/welcome/en/quicktour.html
localizedQuicktour=/boot/system/documentation/welcome/"$language"/quicktour.html
localizedQuicktourBase=/boot/system/documentation/welcome/"$languageBase"/quicktour.html
if [ -f $localizedQuicktourFile ]; then
open file://$localizedQuicktourFile
elif [ -f $quicktourFile ]; then
open $quicktourFile
if [ -f $localizedQuicktour ]; then
open file:$localizedQuicktour
elif [ -f $localizedQuicktourBase ];
open file:$localizedQuicktourBase
elif [ -f $quicktour ]; then
open $quicktour
else
open $quicktourURL
fi

View File

@ -1,13 +1,20 @@
#!/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="\
https://www.haiku-os.org/docs/userguide/en/contents.html"
userGuideDir=/boot/system/documentation/userguide/
userGuide=$userGuideDir/en/contents.html
localizedUserGuide=$userGuideDir/"$LANG"/contents.html
localizedUserGuide=$userGuideDir/"$language"/contents.html
localizedUserGuideBase=$userGuideDir/"$languageBase"/contents.html
if [ -f $localizedUserGuide ]; then
open file://$localizedUserGuide
open file:$localizedUserGuide
elif [ -f $localizedUserGuideBase ]; then
open file:$localizedUserGuideBase
elif [ -f $userGuide ]; then
open $userGuide
else