Merge branch 'translate-tag-names' of https://github.com/ASDFGamer/memories into ASDFGamer-translate-tag-names

dexie
Varun Patil 2023-09-29 19:18:33 -07:00
commit 9eebe8f8e3
2 changed files with 15 additions and 2 deletions

View File

@ -82,6 +82,18 @@ export default defineComponent({
}, },
methods: { methods: {
translated_tag_name(first_item: ICluster,second_item: ICluster) : number {
const first_item_translated = this.t("recognize", first_item.name)
const second_item_translated = this.t("recognize", second_item.name)
if (first_item_translated < second_item_translated) {
return -1;
}
if (first_item_translated > second_item_translated) {
return 1;
}
return 0;
},
async routeChange() { async routeChange() {
try { try {
this.items = []; this.items = [];
@ -94,7 +106,7 @@ export default defineComponent({
if (this.routeIsAlbums) { if (this.routeIsAlbums) {
this.items = await dav.getAlbums(this.config.album_list_sort); this.items = await dav.getAlbums(this.config.album_list_sort);
} else if (this.routeIsTags) { } else if (this.routeIsTags) {
this.items = await dav.getTags(); this.items = (await dav.getTags()).sort(this.translated_tag_name);
} else if (this.routeIsPeople) { } else if (this.routeIsPeople) {
this.items = await dav.getFaceList(<any>this.$route.name); this.items = await dav.getFaceList(<any>this.$route.name);
} else if (this.routeIsPlaces) { } else if (this.routeIsPlaces) {

View File

@ -13,6 +13,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import { translate as t } from '@nextcloud/l10n';
import NcActions from '@nextcloud/vue/dist/Components/NcActions'; import NcActions from '@nextcloud/vue/dist/Components/NcActions';
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton'; import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton';
import * as strings from '../../services/strings'; import * as strings from '../../services/strings';
@ -35,7 +36,7 @@ export default defineComponent({
name(): string | null { name(): string | null {
switch (this.$route.name) { switch (this.$route.name) {
case 'tags': case 'tags':
return this.$route.params.name; return t('recognize',this.$route.params.name);
case 'places': case 'places':
return this.$route.params.name?.split('-').slice(1).join('-'); return this.$route.params.name?.split('-').slice(1).join('-');
default: default: