Skip to content

Commit cdb4c9f

Browse files
3w36zj6Copilot
andauthored
Update website/src/translation/index.tsx
Co-authored-by: Copilot <[email protected]>
1 parent 69e3ccb commit cdb4c9f

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

website/src/translation/index.tsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,14 @@ export type TranslationComponentProps =
9090
export type TranslationComponent = FC<TranslationComponentProps>;
9191

9292
// Switch translation language.
93-
let Translation: TranslationComponent;
94-
let translation: TranslationObject;
95-
96-
switch (language) {
97-
case "ja-JP":
98-
Translation = JaJPTranslation;
99-
translation = jaJPTranslation;
100-
break;
101-
case "en-US":
102-
Translation = EnUSTranslation;
103-
translation = enUSTranslation;
104-
break;
105-
default:
106-
throw new Error(`Unsupported language: ${language}`);
107-
}
93+
const { Translation, translation } = (() => {
94+
switch (language) {
95+
case "ja-JP":
96+
return { Translation: JaJPTranslation, translation: jaJPTranslation };
97+
case "en-US":
98+
return { Translation: EnUSTranslation, translation: enUSTranslation };
99+
default:
100+
throw new Error(`Unsupported language: ${language}`);
101+
}
102+
})();
108103
export { Translation, translation };

0 commit comments

Comments
 (0)