haiku/data/bin/welcome

23 lines
797 B
Plaintext
Raw Normal View History

#!/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="\
2018-08-21 03:58:06 +03:00
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