Skip to content

Commit 9450f59

Browse files
author
Simon Planinschek
committed
Moved Internationalization class in it's own file
1 parent a89c7a7 commit 9450f59

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

src/index.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
class Internationalization<T extends string> {
2-
supportedLanguages: T[]
3-
fallbackLanguage: T
1+
import ClientInternationalization from './ClientInternationalization'
42

5-
constructor(supportedLanguages: T[], fallbackLanguage: T) {
6-
this.supportedLanguages = supportedLanguages
7-
this.fallbackLanguage = fallbackLanguage
8-
}
9-
10-
detectBrowserLanguage(): T {
11-
const browserLanguage =
12-
(navigator.languages && navigator.languages[0]) || navigator.language
13-
14-
return (
15-
this.supportedLanguages.find((lang) => lang === browserLanguage) ||
16-
this.fallbackLanguage
17-
)
18-
}
19-
}
20-
21-
export { Internationalization as default }
3+
export { ClientInternationalization }

0 commit comments

Comments
 (0)