mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Implement pluralization
This commit is contained in:
parent
c6a2752cc6
commit
f187c3c73a
|
@ -57,15 +57,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
rows(): ITagRow[] {
|
rows(): ITagRow[] {
|
||||||
const getUsage = (count: number | undefined) => count && count > 0
|
const getUsage = (count: number | undefined) => count && count > 0
|
||||||
? this.$locale.baseText(
|
? this.$locale.baseText('tagsView.inUse', { adjustToNumber: count })
|
||||||
count > 1 ?
|
|
||||||
'tagsView.inUse.plural' : 'tagsView.inUse.singular',
|
|
||||||
{
|
|
||||||
interpolate: {
|
|
||||||
count: count.toString(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
: this.$locale.baseText('tagsView.notBeingUsed');
|
: this.$locale.baseText('tagsView.notBeingUsed');
|
||||||
|
|
||||||
const disabled = this.isCreateEnabled || this.$data.updateId || this.$data.deleteId;
|
const disabled = this.isCreateEnabled || this.$data.updateId || this.$data.deleteId;
|
||||||
|
|
|
@ -63,8 +63,12 @@ export class I18nClass {
|
||||||
*/
|
*/
|
||||||
baseText(
|
baseText(
|
||||||
key: string,
|
key: string,
|
||||||
options?: { interpolate: { [key: string]: string } },
|
options?: { adjustToNumber: number; interpolate: { [key: string]: string } },
|
||||||
): string {
|
): string {
|
||||||
|
if (options && options.adjustToNumber) {
|
||||||
|
return this.i18n.tc(key, options.adjustToNumber, options && options.interpolate).toString();
|
||||||
|
}
|
||||||
|
|
||||||
return this.i18n.t(key, options && options.interpolate).toString();
|
return this.i18n.t(key, options && options.interpolate).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -356,8 +356,7 @@
|
||||||
"nodeView.showMessage.addNodeButton.message": "'{nodeTypeName}' is an unknown node type",
|
"nodeView.showMessage.addNodeButton.message": "'{nodeTypeName}' is an unknown node type",
|
||||||
"nodeView.showMessage.addNodeButton.title": "Could not create node",
|
"nodeView.showMessage.addNodeButton.title": "Could not create node",
|
||||||
"nodeView.showMessage.keyDown.title": "Workflow created",
|
"nodeView.showMessage.keyDown.title": "Workflow created",
|
||||||
"nodeView.showMessage.showMaxNodeTypeError.message.plural": "Only {maxNodes} '{nodeTypeDataDisplayName}' nodes are allowed in a workflow",
|
"nodeView.showMessage.showMaxNodeTypeError.message": "Only {count} '{nodeTypeDataDisplayName}' node is allowed in a workflow | Only {count} '{nodeTypeDataDisplayName}' nodes are allowed in a workflow",
|
||||||
"nodeView.showMessage.showMaxNodeTypeError.message.singular": "Only {maxNodes} '{nodeTypeDataDisplayName}' node is allowed in a workflow",
|
|
||||||
"nodeView.showMessage.showMaxNodeTypeError.title": "Could not create node",
|
"nodeView.showMessage.showMaxNodeTypeError.title": "Could not create node",
|
||||||
"nodeView.showMessage.stopExecutionCatch.message": "It completed before it could be stopped",
|
"nodeView.showMessage.stopExecutionCatch.message": "It completed before it could be stopped",
|
||||||
"nodeView.showMessage.stopExecutionCatch.title": "Workflow finished executing",
|
"nodeView.showMessage.stopExecutionCatch.title": "Workflow finished executing",
|
||||||
|
@ -541,8 +540,7 @@
|
||||||
"tagsTable.usage": "Usage",
|
"tagsTable.usage": "Usage",
|
||||||
"tagsTableHeader.addNew": "Add new",
|
"tagsTableHeader.addNew": "Add new",
|
||||||
"tagsTableHeader.searchTags": "Search Tags",
|
"tagsTableHeader.searchTags": "Search Tags",
|
||||||
"tagsView.inUse.plural": "{count} workflows",
|
"tagsView.inUse": "{count} workflow | {count} workflows",
|
||||||
"tagsView.inUse.singular": "{count} workflow",
|
|
||||||
"tagsView.notBeingUsed": "Not being used",
|
"tagsView.notBeingUsed": "Not being used",
|
||||||
"template.buttons.goBackButton": "Go back",
|
"template.buttons.goBackButton": "Go back",
|
||||||
"template.buttons.useThisWorkflowButton": "Use this workflow",
|
"template.buttons.useThisWorkflowButton": "Use this workflow",
|
||||||
|
|
|
@ -1256,15 +1256,10 @@ export default mixins(
|
||||||
const maxNodes = nodeTypeData.maxNodes;
|
const maxNodes = nodeTypeData.maxNodes;
|
||||||
this.$showMessage({
|
this.$showMessage({
|
||||||
title: this.$locale.baseText('nodeView.showMessage.showMaxNodeTypeError.title'),
|
title: this.$locale.baseText('nodeView.showMessage.showMaxNodeTypeError.title'),
|
||||||
message: this.$locale.baseText(
|
message: this.$locale.baseText('nodeView.showMessage.showMaxNodeTypeError.message',
|
||||||
maxNodes === 1
|
|
||||||
? 'nodeView.showMessage.showMaxNodeTypeError.message.singular'
|
|
||||||
: 'nodeView.showMessage.showMaxNodeTypeError.message.plural',
|
|
||||||
{
|
{
|
||||||
interpolate: {
|
adjustToNumber: maxNodes,
|
||||||
maxNodes: maxNodes!.toString(),
|
interpolate: { nodeTypeDataDisplayName: nodeTypeData.displayName },
|
||||||
nodeTypeDataDisplayName: nodeTypeData.displayName,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|
Loading…
Reference in a new issue