okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
1306424be
main
1import { LANGUAGES , type Language } from './i18n' ; 2 3/** 4* The first start (nothing saved yet) opens in the language of the computer (#3723): the first of the browser's preferred languages that 5* Strata has. "pt-BR" is Portuguese, "zh-TW" is Chinese (the app has one Chinese, Simplified). Null when none of them is offered. 6*/ 7export function detectLanguage ( tags :readonly string [] | null | undefined ) :Language | null { 8for ( const raw of tags ?? []) { 9const base = String ( raw ). toLowerCase (). split ( / [-_] / )[ 0 ]; 10const found = LANGUAGES . find ( l => l . value === base ); 11if ( found ) return found . value ; 12} 13return null ; 14}