Skip to content

Commit 2fbb3f4

Browse files
authored
Merge pull request #234 from devmount/bugs/fix-locale-processing
Fix locale processing
2 parents f066d86 + b062f68 commit 2fbb3f4

File tree

16 files changed

+216
-203
lines changed

16 files changed

+216
-203
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
A song management web application to store, sync and present songs and setlists, based on [Vue.js](//vuejs.org) and [Firebase](//firebase.google.com). Head over to the docs ([EN](https://github.com/devmount/SongDrive/blob/main/frontend/src/docs/docs.en.md), [DE](https://github.com/devmount/SongDrive/blob/main/frontend/src/docs/docs.en.md)) for more information about SongDrive and how to get started.
1010

11-
> [!NOTE]
12-
> SongDrive is currently being restructured to have its own backend with database, authentication and API endpoints for the frontend. Find more information about this in https://github.com/devmount/SongDrive/issues/213.
11+
> [!NOTE]
12+
> SongDrive is currently being restructured to have its own backend with database, authentication and API endpoints for the frontend. Find more information about this in <https://github.com/devmount/SongDrive/issues/213>.
1313
1414
## Preview
1515

frontend/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ This directory contains all frontend functionality of SongDrive.
3434
9. To give necessary permisstions, click + Start collection again. Input *permissions* as Collection ID and click Next. Insert the copied UID as Document ID and add the following field to the document:
3535
- `role` = string | `admin`
3636
37-
10. Now your app is ready to be launched. Either start the development server with hot reload at `localhost:8080` ...
37+
10. Now your app is ready to be launched. Either start the development server with hot reload at `localhost:5173` ...
3838
3939
```bash
40-
npm run serve
40+
npm run dev
4141
```
4242
4343
11. ... or create an optimized production build with minification. All build files can be found in the `dist` directory.

frontend/package-lock.json

Lines changed: 174 additions & 174 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"dependencies": {
3333
"@kyvg/vue3-notification": "^3.1.3",
3434
"@tabler/icons-vue": "^3.3.0",
35-
"@vuepic/vue-datepicker": "^10.0.0",
35+
"@vuepic/vue-datepicker": "^11.0.0",
3636
"@vueuse/core": "^12.3.0",
3737
"@vueuse/math": "^12.3.0",
3838
"@zip.js/zip.js": "^2.7.45",
@@ -47,7 +47,7 @@
4747
"vue-i18n": "^11.0.1",
4848
"vue-prism-editor": "^2.0.0-alpha.2",
4949
"vue-router": "^4.0.16",
50-
"vue3-carousel": "^0.12.0",
50+
"vue3-carousel": "^0.13.0",
5151
"vuedraggable": "^4.1.0"
5252
},
5353
"devDependencies": {

frontend/src/elements/Tag.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<slot>
66
<icon-tag class="shrink-0 w-4 h-4 stroke-1.5" />
77
<div v-if="tag" class="whitespace-nowrap">
8-
{{ tag[locale] ? tag[locale] : tag.key }}
8+
{{ tag[loc] ? tag[loc] : tag.key }}
99
</div>
1010
<icon-x v-if="closable" class="cursor-pointer w-4 h-4 stroke-1.5" @click="emit('close')" />
1111
</slot>
@@ -20,6 +20,7 @@ import { IconTag, IconX } from '@tabler/icons-vue';
2020
2121
// component constants
2222
const { locale } = useI18n({ useScope: 'global' });
23+
const loc = locale.value.substring(0, 2);
2324
2425
// component properties
2526
const props = defineProps({

frontend/src/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const messages = {
3939
'en': en, // English
4040
};
4141
const loc = !('lang' in localStorage)
42-
? navigator.language || navigator.userLanguage
42+
? navigator.language.substring(0, 2) || navigator.userLanguage.substring(0, 2)
4343
: localStorage.getItem('lang');
4444
const i18n = createI18n({
4545
legacy: false,
@@ -73,7 +73,7 @@ marked.use({
7373
app.provide('marked', marked);
7474

7575
// extend Object for filtering
76-
Object.filter = (obj, predicate) =>
76+
Object.filter = (obj, predicate) =>
7777
Object.keys(obj)
7878
.filter(key => predicate(obj[key]))
7979
.reduce((res, key) => (res[key] = obj[key], res), {});

frontend/src/modals/InfoSongSyntax.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ import Modal from '@/elements/Modal.vue';
2020
2121
// component constants
2222
const { t, locale } = useI18n();
23+
const loc = locale.value.substring(0, 2);
2324
2425
// cheatsheet contents
2526
const cheatsheets = { de, en };
26-
const lang = ['de', 'en'].includes(locale.value) ? locale.value : 'en';
27+
const lang = ['de', 'en'].includes(loc) ? loc : 'en';
2728
2829
// component properties
2930
const props = defineProps({

frontend/src/modals/SetlistSet.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
class="lg:hidden"
4848
pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}"
4949
/>
50-
<div class="text-blade-500">{{ humanDate(setlist.date, locale) }}</div>
50+
<div class="text-blade-500">{{ humanDate(setlist.date, loc) }}</div>
5151
<div v-if="error.date & !setlist.date" class="text-rose-600">
5252
{{ t('error.requiredDate') }}
5353
</div>
@@ -60,8 +60,8 @@
6060
auto-apply
6161
:dark="isDark"
6262
:enable-time-picker="false"
63-
:locale="locale"
64-
:format-locale="calendarLanguage[locale]"
63+
:locale="loc"
64+
:format-locale="calendarLanguage[loc]"
6565
@update:model-value="updateDate"
6666
>
6767
<template #arrow-left>
@@ -102,7 +102,7 @@
102102
</template>
103103
<div class="max-h-80 overflow-y-scroll flex flex-col gap-0.5 !p-2 text-sm">
104104
<tag
105-
v-for="tag in sortTags(tags, locale)" :key="tag.key"
105+
v-for="tag in sortTags(tags, loc)" :key="tag.key"
106106
:tag="tag"
107107
@click="filter.tag = tag.key"
108108
class="cursor-pointer"
@@ -304,6 +304,8 @@ import {
304304
305305
// component constants
306306
const { t, locale } = useI18n();
307+
const loc = locale.value.substring(0, 2);
308+
307309
const calendarLanguage = {
308310
en: enGB,
309311
de: de
@@ -455,7 +457,7 @@ const performedSongs = computed(() => {
455457
setlists.forEach(setlist => {
456458
setlist.songs.forEach(song => {
457459
if (!(song.id in songs)) {
458-
songs[song.id] = humanDate(setlist.date, locale.value, false);
460+
songs[song.id] = humanDate(setlist.date, loc, false);
459461
}
460462
});
461463
});

frontend/src/modals/TagAssign.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
type="checkbox"
2626
class="w-6 h-6 ml-2"
2727
/>
28-
{{ tag[locale] ? tag[locale] : tag.key }}
28+
{{ tag[loc] ? tag[loc] : tag.key }}
2929
</label>
3030
</div>
3131
</div>
@@ -39,7 +39,7 @@
3939
<div class="text-lg text-center mb-2">{{ t('text.selection') }}</div>
4040
<div v-for="tag in sortedSelectedTags" :key="tag" class="flex items-center gap-2">
4141
<icon-tag class="w-4 h-4" />
42-
{{ tags[tag][locale] ? tags[tag][locale] : tag }}
42+
{{ tags[tag][loc] ? tags[tag][loc] : tag }}
4343
<button
4444
class="ml-auto"
4545
@click="selectedTags = selectedTags.filter(k => k !== tag)"
@@ -79,6 +79,7 @@ import {
7979
8080
// component constants
8181
const { t, locale } = useI18n();
82+
const loc = locale.value.substring(0, 2);
8283
8384
// user input properties
8485
const selectedTags = ref([]);
@@ -109,7 +110,7 @@ const filteredTags = computed(() => {
109110
const tag = props.tags[key];
110111
let search = searchInput.value.toLowerCase();
111112
// search in tag labels
112-
let label = tag[locale.value] ? tag[locale.value] : key;
113+
let label = tag[loc] ? tag[loc] : key;
113114
if (label.toLowerCase().indexOf(search) !== -1) {
114115
tags[key] = tag;
115116
}

frontend/src/partials/Login.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
v-model="email"
1212
:class="{ '!border-rose-600': error.email }"
1313
:placeholder="t('field.email')"
14+
autocomplete="email"
1415
required
1516
/>
1617
<input

0 commit comments

Comments
 (0)