mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
If locale detection fails fall back to English
This commit is contained in:
parent
1e91b684cb
commit
0a411fe2fa
1 changed files with 2 additions and 3 deletions
|
@ -16,11 +16,10 @@ Scotty. If not, see <https://www.gnu.org/licenses/>.
|
||||||
package i18n
|
package i18n
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/Xuanwo/go-locale"
|
"github.com/Xuanwo/go-locale"
|
||||||
_ "go.uploadedlobster.com/scotty/internal/translations"
|
_ "go.uploadedlobster.com/scotty/internal/translations"
|
||||||
|
|
||||||
|
"golang.org/x/text/language"
|
||||||
"golang.org/x/text/message"
|
"golang.org/x/text/message"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,7 +28,7 @@ var localizer Localizer
|
||||||
func init() {
|
func init() {
|
||||||
tag, err := locale.Detect()
|
tag, err := locale.Detect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
tag = language.English
|
||||||
}
|
}
|
||||||
localizer = New(tag)
|
localizer = New(tag)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue