-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CONSOLE-2535: Internationalize login page
- Loading branch information
Showing
29 changed files
with
9,602 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package login | ||
|
||
import "golang.org/x/text/language" | ||
|
||
func getLocale(langBase string) map[string]string { | ||
switch langBase { | ||
case language.English.String(): | ||
return locale_en | ||
case language.Chinese.String(): | ||
return locale_zh | ||
case language.Japanese.String(): | ||
return locale_jp | ||
case language.Korean.String(): | ||
return locale_ko | ||
default: | ||
return locale_en | ||
} | ||
} | ||
|
||
func getPrefferedLang(acceptLangHeader string) string { | ||
matcher := language.NewMatcher(supportedLangs) | ||
userPrefs, _, err := language.ParseAcceptLanguage(acceptLangHeader) | ||
if err != nil { | ||
// if error occurs, fallback to English | ||
return language.English.String() | ||
} | ||
tag, _, _ := matcher.Match(userPrefs...) | ||
base, _ := tag.Base() | ||
return base.String() | ||
} | ||
|
||
var supportedLangs = []language.Tag{ | ||
language.English, // en - first language is fallback | ||
language.Chinese, // zh | ||
language.Japanese, // jp | ||
language.Korean, // ko | ||
} | ||
|
||
var locale_en = map[string]string{ | ||
"": "", | ||
} | ||
|
||
var locale_zh = map[string]string{ | ||
"": "", | ||
} | ||
|
||
var locale_jp = map[string]string{ | ||
"": "", | ||
} | ||
|
||
var locale_ko = map[string]string{ | ||
"": "", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
vendor/golang.org/x/text/internal/language/compact/compact.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.