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

Translation strings partials should be linked with the whole sentence. #617

Closed
1 task
obulat opened this issue Feb 17, 2022 · 2 comments · Fixed by #3988
Closed
1 task

Translation strings partials should be linked with the whole sentence. #617

obulat opened this issue Feb 17, 2022 · 2 comments · Fixed by #3988
Assignees
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: frontend Related to the Nuxt frontend

Comments

@obulat
Copy link
Contributor

obulat commented Feb 17, 2022

Problem

Currently, we are using the Vue-i18n's json file format for our strings that need to be translated. To use an HTML element within a string, we split a string into 2 values.

For example, the disclaimer from the homepage contains a link within it. Below you can see the HTML result and the JSON values that are used for it:
`

All Openverse content is under a Creative Commons license or is in the public domain.

"disclaimer": {
  "content": "All Openverse content is under a {license} or is in the public domain.",
  "license": "Creative Commons license"
},

In the PolyGlot interface, the translators see the two parts of this sentence as separate strings, and it is not possible to understand that they are part of the same sentence. This can be fine for languages that don't change the word forms based on their sentence role (as English). But for Russian, for example, translating the license key value cannot be done correctly without knowing the sentence it is used in. Here you can see the two strings in the translation interface:
Screen Shot 2022-02-16 at 4 58 01 PM

Description

We should investigate the best way of linking the strings that are part of a sentence in the Vue JSON format.

Implementation

  • 🙋 I would be interested in implementing this feature.
@obulat obulat added 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository labels Feb 17, 2022
@sarayourfriend
Copy link
Collaborator

@obulat could we use the v-html directive and include the HTML directly in the translated strings? Or potentially add "holes" in the text that could be passed through sprintf or something like that? Translation strings like the example would then become:

All Openverse content is under a %sCreative Commons license%s or is in the public domain.

Or something like that? Then sprintf can "just" (I think this is probably more complicated than a "just" 😛) format the translated string with the HTML. This could be done in postTranslation maybe? I'm not sure how we'd pass the HTML tags through as arguments 😞 Of course, we could create a wrapper around the i18n translation methods that used sprintf and allowed passing HTML to the strings. vue-i18n recommends against using v-html due to XSS issues but I think it would be safe as long as we trust the translation source 🤔

@obulat obulat transferred this issue from WordPress/openverse-frontend Feb 22, 2023
@obulat obulat added the 🧱 stack: frontend Related to the Nuxt frontend label Feb 22, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Openverse Backlog Feb 23, 2023
@lidialab
Copy link

lidialab commented Mar 7, 2023

I totally agree with @obulat.
These difficulties are there also for the Italian locale.

@krysal krysal added 🟨 priority: medium Not blocking but should be addressed soon and removed 🟩 priority: low Low priority and doesn't need to be rushed labels Mar 8, 2023
@obulat obulat added 🟧 priority: high Stalls work on the project or its dependents and removed 🟨 priority: medium Not blocking but should be addressed soon labels Mar 28, 2024
@obulat obulat moved this from 📋 Backlog to 📅 To Do in Openverse Backlog Mar 28, 2024
@obulat obulat self-assigned this Mar 28, 2024
@openverse-bot openverse-bot moved this from 📅 To Do to 🏗 In Progress in Openverse Backlog Mar 29, 2024
@openverse-bot openverse-bot moved this from 🏗 In Progress to ✅ Done in Openverse Backlog Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟧 priority: high Stalls work on the project or its dependents 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants