haiku/data/bin/welcome
Pascal Abresch 99d1318ec0 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>
2023-01-18 12:46:12 +00:00

23 lines
797 B
Bash
Executable File

#!/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"
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
elif [ -f $localizedWelcomeFileBase ]; then
open file:$localizedWelcomeFileBase
elif [ -f $welcomeFile ]; then
open $welcomeFile
else
open $welcomeURL
fi