Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Malformed variable interpolation for translations #340

Closed
1 task
sarayourfriend opened this issue Oct 19, 2021 · 4 comments · Fixed by #347
Closed
1 task

Malformed variable interpolation for translations #340

sarayourfriend opened this issue Oct 19, 2021 · 4 comments · Fixed by #347
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟥 priority: critical Must be addressed ASAP

Comments

@sarayourfriend
Copy link
Contributor

Description

Something is wrong with the translated pot -> json pipeline. Some variable interpolations are not working as expected

Captura de Tela 2021-10-19 às 07 55 57

Reproduction

Switch to German and create a query with no results (like kingfisher with the source filtered to thingiverse) and note the malformed variable interpolation resulting in ###query### displaying on the screen.

Expectation

Variable interpolations should all be transformed from the POT format to the format that VueI18n understands.

Resolution

  • 🙋 I would be interested in resolving this bug.
@sarayourfriend sarayourfriend added 🟧 priority: high Stalls work on the project or its dependents 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository labels Oct 19, 2021
@zackkrida zackkrida added 🟥 priority: critical Must be addressed ASAP and removed 🟧 priority: high Stalls work on the project or its dependents 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Oct 19, 2021
@zackkrida
Copy link
Member

Thank you for finding this @sarayourfriend

@0kyn
Copy link
Contributor

0kyn commented Oct 21, 2021

Hi @sarayourfriend,

It might be a similar issue spotted by @zackkrida. - somehow related

The problem seems to come from Wordpress translation project:

Link to filter
image

@obulat
Copy link
Contributor

obulat commented Oct 21, 2021

@0kyn, GlotPress WordPress translation project uses the ###placeholder### syntax to mark the words that do not need translation. We convert the placeholders that we use in Vue's json English file (that are in form phrase with a {placeholder}) into the syntax that is used by GlotPress (phrase with a ###placeholder###) before loading the strings to GlotPress. Then we get the translations back, and convert them into the original Vue placeholder format.

The bug is caused by not using g global flag in the regex that we use to replace the placeholders. So, if there are more than one placeholders in a string, only the first one gets replaced.

@obulat obulat mentioned this issue Oct 21, 2021
7 tasks
@0kyn
Copy link
Contributor

0kyn commented Oct 21, 2021

I got it, thank you @obulat! I took a wrong track... 😅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟥 priority: critical Must be addressed ASAP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants