Improve translations by using named fomatting
See original GitHub issueWhat is the motivation for adding / enhancing this feature?
Translation strings which are composed of multiple pieces like for example https://github.com/DivanteLtd/vue-storefront/blob/38fb1579c60d1aa352d353c06c1f0d9af7f79937/src/themes/default/components/core/GenericSelector.vue#L6 or https://github.com/DivanteLtd/vue-storefront/blob/6995f88dab30cbd2a10dcd6874891f6566124320/src/themes/default/components/core/ColorSelector.vue#L5 force the pieces to be composed in this exact order. So, for example first "Select " and then always followed by the label. Considering the following German translation, this results in “Auswählen Größe” which sounds really stupid as it is simply incorrect grammar:
- "Select " translated with "Auswählen "
- label having a value of “Größe”
Correct would be “Größe auswählen”.
What are the acceptance criteria
A translation string needs to be able to define the order of how the pieces get put together.
Can you complete this feature request by yourself?
- YES
- NO
Which Release Cycle state this refers to?
- This is a normal feature request. This should be available on https://test.storefrontcloud.io and then after tests this can be added to next Vue Storefront version. In this case Developer should create branch from
develop
branch and create Pull Request2. Feature / Improvement
back todevelop
. - (Pick this option only if you’re sure) This is an important improvement request for current Release Candidate version on https://next.storefrontcloud.io and should be placed in next RC version. In this case Developer should create branch from
release
branch and create Pull Request3. Stabilisation fix
back torelease
. - (Pick this option only if you’re sure) This is a critical improvement request for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version. In this case Developer should create branch from
hotfix
ormaster
branch and create Pull Request4. Hotfix
back tohotfix
.
Additional information
I propose that all translations which are composed of multiple strings/translations use named formatting. This feature is already available (vue-i18n), only need to refactor existing code to take advantage of it. Translations for the above mentioned examples would look like this:
"Select {label}","{label} auswählen"
"Select color {label}","Farbe '{color}' auswählen"
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top GitHub Comments
Hi @phoenixdev-kl, it was a general request. Some translations sound pretty weird and choppy, so named formatting is a good thing.
@pkarw great! sorry, the process is unfortunately not clear to me. if this feature is planned for 2.0, from which branch do i create a branch in my fork (release/v2.0 or develop)? and when the refactoring is finished, am i supposed to create the pull request in release/2.0?