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

Remove %{type} from translation strings and use explicit strings for … #3769

Merged
merged 1 commit into from
Jul 13, 2020
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
8 changes: 5 additions & 3 deletions apps/files/src/components/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export default {
data() {
return {
labelSelectAllItems: this.$gettext('Select all items'),
labelSelectSingleItemText: this.$gettext('Select %{type} %{name}'),
rowActions: [],
rowActionsDisplayed: false,
rowActionsItem: {}
Expand Down Expand Up @@ -219,9 +218,12 @@ export default {
]),

labelSelectSingleItem(item) {
const labelSelectSingleFileText = this.$gettext('Select file %{name}')
const labelSelectSingleFolderText = this.$gettext('Select folder %{name}')

return this.$gettextInterpolate(
this.labelSelectSingleItemText,
{ name: item.name, type: item.type },
item.type === 'file' ? labelSelectSingleFileText : labelSelectSingleFolderText,
{ name: item.name },
true
)
},
Expand Down
5 changes: 3 additions & 2 deletions apps/files/src/components/FileSharingSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,9 @@ export default {
return this.highlightedFile.canShare()
},
noResharePermsMessage() {
const translated = this.$gettext("You don't have permission to share this %{type}.")
return this.$gettextInterpolate(translated, { type: this.highlightedFile.type }, false)
const translatedFile = this.$gettext("You don't have permission to share this file.")
PVince81 marked this conversation as resolved.
Show resolved Hide resolved
const translatedFolder = this.$gettext("You don't have permission to share this folder.")
return this.highlightedFile.type === 'file' ? translatedFile : translatedFolder
},

currentUsersPermissions() {
Expand Down
12 changes: 10 additions & 2 deletions apps/files/src/components/LocationPicker/LocationPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,18 @@ export default {

if (this.currentAction === 'move') {
title = this.$gettext('An error occurred while moving several resources')
desc = this.$gettext('%{count} resources could not be moved')
desc = this.$ngettext(
'%{count} resource could not be moved',
'%{count} resources could not be moved',
errors.length
)
} else if (this.currentAction === 'copy') {
title = this.$gettext('An error occurred while copying several resources')
desc = this.$gettext('%{count} resources could not be copied')
desc = this.$ngettext(
'%{count} resource could not be copied',
'%{count} resources could not be copied',
errors.length
)
}

this.showMessage({
Expand Down
46 changes: 29 additions & 17 deletions apps/files/src/mixins/deleteResources.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,44 +25,56 @@ export default {
let title = null

if (resources.length === 1) {
title = this.$_deleteResources_isInTrashbin
? this.$gettext('Permanently delete %{type} %{name}')
: this.$gettext('Delete %{type} %{name}')

if (isFolder) {
title = this.$_deleteResources_isInTrashbin
? this.$gettext('Permanently delete folder %{name}')
: this.$gettext('Delete folder %{name}')
} else {
title = this.$_deleteResources_isInTrashbin
? this.$gettext('Permanently delete file %{name}')
: this.$gettext('Delete file %{name}')
}
return this.$gettextInterpolate(
title,
{
type: isFolder ? this.$gettext('folder') : this.$gettext('file'),
name: resources[0].name
},
true
)
}

title = this.$_deleteResources_isInTrashbin
? this.$gettext('Permanently delete %{amount} selected resources?')
: this.$gettext('Delete %{amount} selected resources')
? this.$ngettext(
'Permanently delete %{amount} selected resource?',
'Permanently delete %{amount} selected resources?',
resources.length
)
: this.$ngettext(
'Delete %{amount} selected resource?',
'Delete %{amount} selected resources?',
resources.length
)

return this.$gettextInterpolate(title, { amount: resources.length }, false)
},

$_deleteResources_dialogMessage() {
const resources = this.$_deleteResources_resources
const isFolder = resources[0].type === 'folder'
let message = null

if (resources.length === 1) {
message = this.$_deleteResources_isInTrashbin
if (isFolder) {
return this.$_deleteResources_isInTrashbin
? this.$gettext(
'Are you sure you want to delete this folder? All it’s content will be permanently removed. This action cannot be undone.'
)
: this.$gettext('Are you sure you want to delete this folder?')
}
return this.$_deleteResources_isInTrashbin
? this.$gettext(
'Are you sure you want to delete this %{type}? All it’s content will be permanently removed. This action cannot be undone.'
'Are you sure you want to delete this file? All it’s content will be permanently removed. This action cannot be undone.'
)
: this.$gettext('Are you sure you want to delete this %{type}?')

return this.$gettextInterpolate(
message,
{ type: isFolder ? this.$gettext('folder') : this.$gettext('file') },
true
)
: this.$gettext('Are you sure you want to delete this file?')
}

return this.$_deleteResources_isInTrashbin
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/3769
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix translations string

Allow better translations of various strings.

https://github.com/owncloud/phoenix/pull/3766
https://github.com/owncloud/phoenix/pull/3769