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

feat: [#175659067] Using placeholder in yaml/locale #2363

Merged
merged 10 commits into from
Nov 11, 2020

Conversation

Undermaken
Copy link
Contributor

@Undermaken Undermaken commented Nov 10, 2020

Short description

This PR tries to improve the locales generation with the usage of placeholders.
Now you can refer to a value already defined in the yaml as a placeholder. That placeholder will be replaced with relative value on running yarn generate:locales command

how to use this feature

Often your text includes the same word. Now you can refer to it with a placeholder

global:
  app_name: Amazing App
  welcome_message: Welcome to a new version of ${global.app_name}
  description: Current version: ${global.info.version}
  info:
    version: 1.0.0

generated locales will be

{
  "global": {
    "app_name": "Amazing App",
    "welcome_message": "Welcome to a new version of Amazing App",
    "description": "Current version: 1.0.0",
    "info": {
      "version": "1.0.0"
    }
  }
}

@pagopa-github-bot pagopa-github-bot changed the title [#175659067] Using placeholder in yaml/locale feat: [#175659067] Using placeholder in yaml/locale Nov 10, 2020
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Nov 10, 2020

Affected stories

  • 🌟 #175659067: Come DEV nello yaml delle local voglio poter riferirmi al valore di altri campi usando un placeholder

Generated by 🚫 dangerJS against e845ee4

@codecov-io
Copy link

codecov-io commented Nov 10, 2020

Codecov Report

Merging #2363 (4dfdeaa) into master (a846289) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2363   +/-   ##
=======================================
  Coverage   48.87%   48.87%           
=======================================
  Files         633      633           
  Lines       17763    17763           
  Branches     3502     3502           
=======================================
  Hits         8682     8682           
  Misses       9039     9039           
  Partials       42       42           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a846289...e845ee4. Read the comment docs.

Copy link
Contributor

@fabriziofff fabriziofff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using multiple reference inside a string it fails to retrieve all the dependecies.
With this test:

      card:
        a: "ciao "
        b: "${bonus.bpd.details.card.a} ${bonus.bpd.details.card.a}"

The output is:

Schermata 2020-11-11 alle 09 35 38

It could be a common case, often in very long texts the same key can be repeated several times (eg. bonus vacanze).

@Undermaken
Copy link
Contributor Author

Using multiple reference inside a string it fails to retrieve all the dependecies.
With this test:

      card:
        a: "ciao "
        b: "${bonus.bpd.details.card.a} ${bonus.bpd.details.card.a}"

The output is:

Schermata 2020-11-11 alle 09 35 38

It could be a common case, often in very long texts the same key can be repeated several times (eg. bonus vacanze).

@fabriziofff absolutely, this is a bug!
a00b574 commit should fix

@fabriziofff fabriziofff merged commit 7fb9fb6 into master Nov 11, 2020
@fabriziofff fabriziofff deleted the 175659067-yaml-placeholders branch November 11, 2020 13:28
Undermaken added a commit that referenced this pull request Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants