question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linked Pluralization

See original GitHub issue

using vue 2.2.6 and vue-i18n 6.1.1

Can this be done? I’m trying to do a “action string” ex: User added 1 photo - if there are more photos i want to show “photos”

i have this

export default {
	en: {
		actions: {
			photo: 'added {count} @:photo'
		},
		photo: 'photo | photos'
	}
}

How do I pass the count parameter in a pluralized linked locale message ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:10
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

20reactions
rijkvanzantencommented, Jan 23, 2018

While I agree with @amertum’s point on duplicates not being a bad thing ,I don’t fully agree with the points on maintenance and other languages causing problems

In my particular use case:

// en.js
export default {
  name:            'Name',
  collection:      'Collection | Collections',
  file:            'File | Files',

  collection_name: '@:collection @:name',
  file_name:       '@:file @:name'
};

the names collection and file are used in a lot of different instances (this is only a subset) and don’t change between instances. By using the linked locale messages feature, we can prevent spelling errors by only having to enter the “general” terms once.

Next to this, additional translations can be a lot smaller by using the fallback language for the combined messages like follows:

// nl.js
export default {
  name:            'Naam',
  collection:      'Collectie | Collecties',
  file:            'Bestand | Bestanden',

  // use English fallback for collection_name & file_name
};

If the combined message doesn’t fit well in the other language, the linked locale message can be updated on a per-instance basis:

// nl.js
export default {
  name:            'Naam',
  collection:      'Collectie | Collecties',
  file:            'Bestand | Bestanden',
  
  // use English fallback for collection_name

  // Override file_name for Dutch
  file_name: '@:name van het @:file'
};

First syntax ideas:

@:apple @:apple(1) @:apple(10, { count: 10 })

OR:

@:apple @:apple:1 @:apple:10:{"count": 10}

@kazupon What are your thoughts on the matter? Would you be interested in figuring out an addition to the linked locale message syntax in order to support pluralization?

4reactions
brunosmmcommented, Nov 13, 2020

Hello all,

Is there any update on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plurals of Linked Words - Grammar-Quizzes
Occasionally, we pluralize the final element, especially when the compound includes a preposition, a repeated word, linked words, or the suffix -ful.
Read more >
linked - Wiktionary
linked (comparative more linked, superlative most linked). connected, either with links, or as if with links; (computing) having links (between modules, ...
Read more >
Vue i18n : Pluralization and Linked Messages not interpreted ...
The Plurals and Linked messages syntax in the locales messages should be interpreted by vue-i18n and not display the full locale message string....
Read more >
Pluralization in software tutorial: JavaScript & Java examples
linkedin. Due to its deceptive simplicity, pluralization can be a somewhat overlooked element when handling strings in programs.
Read more >
They Exist! Introducing Plural Mentions to Coreference ...
This paper analyzes arguably the most challenging yet under-explored aspect of resolution tasks such as coreference resolution and entity linking, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found