Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing translations #11804

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/bugfix-missing-translations
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Add missing translations

Missing translations for the tile sort options and the editor "Save"-button have been added.

https://github.com/owncloud/web/pull/11804
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { useSideBar } from '@ownclouders/web-pkg'
import { queryItemAsString, useRouteQuery } from '@ownclouders/web-pkg'
import {
determineResourceTableSortFields,
determineResourceTilesSortFields
determineResourceTilesSortFields,
translateSortFields
} from '@ownclouders/web-pkg'
import { Task } from 'vue-concurrency'
import { Resource } from '@ownclouders/web-client'
Expand All @@ -27,6 +28,7 @@ import {
} from '@ownclouders/web-pkg'

import { ScrollToResult, useScrollTo } from '@ownclouders/web-pkg'
import { useGettext } from 'vue3-gettext'

interface ResourcesViewDefaultsOptions<T, U extends any[]> {
loadResourcesTask?: Task<T, U>
Expand Down Expand Up @@ -64,6 +66,7 @@ export const useResourcesViewDefaults = <T extends Resource, TT, TU extends any[
return loadResourcesTask.isRunning || !loadResourcesTask.last
})

const language = useGettext()
const resourcesStore = useResourcesStore()
const storeItems = computed(() => resourcesStore.activeResources) as unknown as Ref<T[]>

Expand All @@ -83,7 +86,7 @@ export const useResourcesViewDefaults = <T extends Resource, TT, TU extends any[

const sortFields = computed((): SortField[] => {
if (unref(viewMode) === FolderViewModeConstants.name.tiles) {
return determineResourceTilesSortFields(unref(storeItems)[0])
return translateSortFields(determineResourceTilesSortFields(unref(storeItems)[0]), language)
}
return determineResourceTableSortFields(unref(storeItems)[0])
})
Expand Down
4 changes: 2 additions & 2 deletions packages/web-app-files/src/views/spaces/Projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ import FilesViewWrapper from '../../components/FilesViewWrapper.vue'
import { ResourceTable, ResourceTiles } from '@ownclouders/web-pkg'
import { eventBus } from '@ownclouders/web-pkg'
import { SideBarEventTopics, useSideBar } from '@ownclouders/web-pkg'
import { sortFields as availableSortFields } from '@ownclouders/web-pkg'
import { sortFields as availableSortFields, translateSortFields } from '@ownclouders/web-pkg'
import { defaultFuseOptions, formatFileSize, ResourceIcon } from '@ownclouders/web-pkg'
import { useGettext } from 'vue3-gettext'
import { useKeyboardActions } from '@ownclouders/web-pkg'
Expand Down Expand Up @@ -294,7 +294,7 @@ export default defineComponent({
'mdate'
]

const sortFields = availableSortFields
const sortFields = translateSortFields(availableSortFields, language)
const {
sortBy,
sortDir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ export default defineComponent({
isDisabled: () => isReadOnly.value || !isDirty.value,
icon: 'save',
id: 'app-save-action',
label: () => 'Save',
label: () => $gettext('Save'),
handler: save
}
]
Expand Down
5 changes: 5 additions & 0 deletions packages/web-pkg/src/helpers/ui/resourceTiles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Resource } from '@ownclouders/web-client'
import { SortDir, SortField } from '../../composables/sort'
import { Language } from 'vue3-gettext'

// just a dummy function to trick gettext tools
function $gettext(msg: string) {
Expand Down Expand Up @@ -75,3 +76,7 @@ export const determineResourceTilesSortFields = (firstResource: Resource): SortF
Object.prototype.hasOwnProperty.call(firstResource, field.name)
)
}

export const translateSortFields = (fields: SortField[], { $gettext }: Language): SortField[] => {
return fields.map((field) => ({ ...field, label: $gettext(field.label) }))
}