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

Fallback locales not taken into account for pseudoLocale #1213

Closed
um-synth opened this issue Feb 25, 2022 · 5 comments · Fixed by #1293
Closed

Fallback locales not taken into account for pseudoLocale #1213

um-synth opened this issue Feb 25, 2022 · 5 comments · Fixed by #1293

Comments

@um-synth
Copy link

um-synth commented Feb 25, 2022

Describe the bug
Hi.

When setting up a pseudo local I have a problem that instead of using values of fallback locale, pseudo local messages are generated from the ids. In our case ids are not the same as default values, which makes pseudo local language a bit useless.
Not sure if this is intentional or a bug? Following the documentation, I would consider that a bug.

To Reproduce
Our .linguirc setup:

{
  "locales": [
    "en",
    "en-PL"
  ],
  "sourceLocale": "en",
  "pseudoLocale": "en-PL",
  "fallbackLocales": {
    "en-PL": "en",
    "default": "en"
  },
  "catalogs": [
    {
      "path": "src/locales/{locale}/messages",
      "include": [
        "src"
      ]
    }
  ],
  "format": "po"
}


Please let me know if you need any additional information.

@sharonyogev
Copy link
Contributor

Hi, this is because compileSingleKey uses the key and not the translation
But, when I tried to replace it with translation some of the translations failed the compilation process, for example:

  • {count, plural, one {boy} other {# boys}} {count, plural, one {girl} other {# girls}}
  • {class} {count, plural, one {boy} other {# boys}}

As I see it, there are 2 solutions:

  1. try to fix the escaping in pseudoLocalize.ts - I think it will be hard/impossible to be bulletproof since the language is not regular (we need to count the number of { for example), but more than possible to fix most common issues
  2. do the pseolocalization in compile.ts in the processTokens function, it's safer since it's after we parsed the message-format and we traverse the AST so we know the type of each token

What do you think?

@stale
Copy link

stale bot commented May 25, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 25, 2022
@sharonyogev
Copy link
Contributor

Bump? Has anyone looked at it?

@um-synth
Copy link
Author

um-synth commented Jun 2, 2022

Hi. Sorry - I moved fwd with formatjs for now, since that was quite painful not to have. Though - maybe I will find some time during next month to take a look how this could be done based on the suggestion from @sharonyogev.

@stale stale bot removed the wontfix label Jun 2, 2022
@stale
Copy link

stale bot commented Aug 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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 a pull request may close this issue.

3 participants