generated from Seekra/repository-template
Add more Languages and switch button #70
Reference in New Issue
Block a user
Delete Branch "feature/add-languages"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes: #69
@@ -0,0 +23,4 @@const isOpen = ref(false);const languages = [Please do not use hard-coded values. All strings should be in the locale files.
@@ -0,0 +36,4 @@() => languages.find(l => l.code === locale.value) ?? languages[0]);async function selectLanguage(code) {I think an extra function that simply calls another function is not necessary.
@@ -0,0 +49,4 @@}function closeOnBlur() {// Kleines Delay damit Click auf Option noch registriert wirdI ask you to speak English.
Should we say „Sie“ or „Du“ in German?
I suggest naming the directory
src/features/i18n//src/features/internationalization/src/features/locale_preferences.@@ -0,0 +40,4 @@await loadLanguage(code);localStorage.setItem('locale', code);document.documentElement.lang = code;document.documentElement.dir = code === 'ar' ? 'rtl' : 'ltr';Consider that Arabic isn't the only language written from right to left.
When you open the dropdown menu, select a language, and then click on it again, it closes immediately.
@@ -0,0 +24,4 @@const isOpen = ref(false);const languages = [{ code: 'en', label: 'English', flag: '🇬🇧' },You do not need lines
const currentLanguage = …if you simply writeThere is no error handling if a locale does not exist.
@@ -21,3 +21,3 @@const SUPPORTED_LANGUAGES = ['en''en', 'de', 'fr', 'es', 'it', 'pt', 'zh', 'ja', 'ar', 'hi'Not all of these languages are supported.
@@ -0,0 +111,4 @@border-radius: 6px;padding: 4px 10px;cursor: pointer;font-size: 0.9rem;Why did you do that?