Skip to content

Commit

Permalink
Fixed locale selection and filtering, all tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
Anvita Prasad committed Feb 10, 2025
1 parent 6b983d9 commit d1d4bf9
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions td.vue/src/components/LocaleSelect.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="locale-changer">
<b-dropdown right :text="getLanguageName(locale)" variant="primary">
<b-dropdown right :text="locale" variant="primary">
<div class="px-2 py-2">
<input type="text" v-model="searchQuery" class="form-control" placeholder="Search language..." @click.stop
@input="filterLocales" />
Expand All @@ -26,11 +26,10 @@ export default {
return {
searchQuery: '',
filteredLocales: []
}
};
},
created() {
// Initialize filteredLocales with all available locales
this.filteredLocales = this.$i18n.availableLocales;
this.filteredLocales = [...this.$i18n.availableLocales];
},
computed: {
...mapState({
Expand Down Expand Up @@ -85,34 +84,34 @@ export default {
},
getLanguageName(locale) {
switch (locale) {
case 'ara':
return 'العربية'; // Arabic
case 'deu':
return 'Deutsch'; // German
case 'ell':
return 'Ελληνικά'; // Greek
case 'eng':
return 'eng';
case 'spa':
return 'Español'; // Spanish
case 'fin':
return 'Suomi'; // Finnish
case 'fra':
return 'Français'; // French
case 'hin':
return 'हिंदी'; // Hindi
case 'id':
return 'Bahasa Indonesia'; // Indonesia
case 'jpn':
return '日本語'; // Japanese
case 'ms':
return 'Malay'; // Malay
case 'por':
return 'Português'; // Portuguese
case 'zho':
return '中文'; // Chinese
default:
return locale;
case 'ara':
return 'العربية'; // Arabic
case 'deu':
return 'Deutsch'; // German
case 'ell':
return 'Ελληνικά'; // Greek
case 'eng':
return 'English';
case 'spa':
return 'Español'; // Spanish
case 'fin':
return 'Suomi'; // Finnish
case 'fra':
return 'Français'; // French
case 'hin':
return 'हिंदी'; // Hindi
case 'id':
return 'Bahasa Indonesia'; // Indonesia
case 'jpn':
return '日本語'; // Japanese
case 'ms':
return 'Malay'; // Malay
case 'por':
return 'Português'; // Portuguese
case 'zho':
return '中文'; // Chinese
default:
return locale;
}
},
getSearchableText(name) {
Expand Down

0 comments on commit d1d4bf9

Please sign in to comment.