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

{locale} and {name} are only replaced once in the catalog paths #1274

Closed
tannerlyons opened this issue Aug 12, 2022 · 2 comments · Fixed by #1342
Closed

{locale} and {name} are only replaced once in the catalog paths #1274

tannerlyons opened this issue Aug 12, 2022 · 2 comments · Fixed by #1342

Comments

@tannerlyons
Copy link
Contributor

tannerlyons commented Aug 12, 2022

Describe the bug

For one of our localization vendors, we need to provide them with unique po file names. We have ~8 components that lingui manages translations for that each have the same filesystem pattern.

catalog path (taken directly from the docs):

path: "components/{name}/locales/{locale}/messages",

Filesystem:

src/
    component-one/
        locales/
            de/
                messages.po
            en/
                messages.po
            ...6 others...
    component-two/
        locales/
            de/
                messages.po
            en/
                messages.po
            ...6 others...

To generate unique filenames and keep the po files separated into their respective component folders, we'd need something more like the following. The name and locale strings would have to be replaced globally throughout the path string when locating po files and extracting messages.

Catalog path:

path: "components/{name}/i18n/locales/{name}_messages_{locale}",
-or-
path: "components/{name}/i18n/locales/{locale}/{name}_messages_{locale}",

Ideal Filesystem:

components/
    component-one/
        locales/
            component-one_messages_en.po
            component-one_messages_es.po
            ...6 others...
    component-two/
        locales/
            component-two_messages_en.po
            component-two_messages_es.po
            ...6 others...

I have a fork w/ some tests that are passing but I don't quite know if that's enough to feel confident... My question is: Would you be interested in a PR that attempted to do this?

If the answer is yes, I'll fill out everything below and link my fork!


To Reproduce
Steps to reproduce the behavior, possibly with minimal code sample, e.g:

import { Trans } from "@lingui/react"

export default function App() {
   return <Trans>This should be translated!</Trans>
}

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Add any other context about the problem here.

  • jsLingui version lingui --version
  • Babel version npm list @babel/core
  • Your Babel config (e.g. .babelrc) or framework you use (Create React App, Meteor, etc.)
@tannerlyons
Copy link
Contributor Author

Does anyone have time to take a quick peek at this and give me a "yes we're interested" or "no, don't pursue this"?

I have a fork w/ some tests that are passing but I don't quite know if that's enough to feel confident... My question is: Would you be interested in a PR that attempted to do this?

@stale
Copy link

stale bot commented Oct 15, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants