1#!/bin/bash 2 3language=$(locale -l) 4# The locale can be a single 2 char language or in severall segments like en, se_SE or sr_Latn_ME 5# this tries to get the 2 char language code from longer locales as a fallback 6languageBase=$(echo $language | awk -F_ '{print $1}') 7userGuideURL="\ 8 https://www.haiku-os.org/docs/userguide/en/contents.html" 9userGuideDir=/boot/system/documentation/userguide/ 10userGuide=$userGuideDir/en/contents.html 11localizedUserGuide=$userGuideDir/"$language"/contents.html 12localizedUserGuideBase=$userGuideDir/"$languageBase"/contents.html 13 14if [ -f $localizedUserGuide ]; then 15 open file:$localizedUserGuide 16elif [ -f $localizedUserGuideBase ]; then 17 open file:$localizedUserGuideBase 18elif [ -f $userGuide ]; then 19 open $userGuide 20else 21 open $userGuideURL 22fi 23 24