just a couple tiny changes to i18n related code.
This commit is contained in:
parent
9454eda791
commit
d45cd21847
2 changed files with 1 additions and 6 deletions
|
|
@ -1,12 +1,6 @@
|
||||||
import en from './en.json';
|
import en from './en.json';
|
||||||
import jp from './jp.json';
|
import jp from './jp.json';
|
||||||
|
|
||||||
|
|
||||||
export const languages = {
|
|
||||||
en: 'English',
|
|
||||||
jp: "日本語",
|
|
||||||
};
|
|
||||||
|
|
||||||
export const defaultLang = 'en';
|
export const defaultLang = 'en';
|
||||||
|
|
||||||
export const ui = {
|
export const ui = {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { ui, defaultLang } from './ui';
|
import { ui, defaultLang } from './ui';
|
||||||
|
|
||||||
export function getLangFromUrl(url: URL) {
|
export function getLangFromUrl(url: URL) {
|
||||||
|
// comma lol
|
||||||
const [, lang] = url.pathname.split('/');
|
const [, lang] = url.pathname.split('/');
|
||||||
if (lang in ui) return lang as keyof typeof ui;
|
if (lang in ui) return lang as keyof typeof ui;
|
||||||
return defaultLang;
|
return defaultLang;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue