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

Place PO file relatively to the component file #2025

Open
hejtmii opened this issue Sep 2, 2024 · 2 comments
Open

Place PO file relatively to the component file #2025

hejtmii opened this issue Sep 2, 2024 · 2 comments

Comments

@hejtmii
Copy link

hejtmii commented Sep 2, 2024

Is your feature request related to a problem? Please describe.
We are using AI to help with our codebase. We would auto-translate the PO files giving the AI also the original source file code to get as much context as possible. To effectively script it and keep it near the original context, we would like to place the PO file in the same directory as the original source code.

However, the {name} macro only gives the name of the original file...

Describe proposed solution
Offer some {dir} macro that will resolve into a folder of the source component

Describe alternatives you've considered
I was thinking about {path} macro as a full path to the component, but I think dir is more versatile, as it can be combined with {name} when needed and cover both (all) needs that I can imagine

Additional context
I could create a PR for this if approved. Otherwise I would like to learn if there are any serious reasons why you wouldn't like it.

@vonovak
Copy link
Collaborator

vonovak commented Sep 2, 2024

Hello and thanks for asking,

we would like to place the PO file in the same directory as the original source code.

probably not as fine-grained as you want it but take a look at this config

However, the {name} macro only gives the name of the original file...

I'm afraid I don't follow what you're saying TBH. Can you expand?

TY 🙂

@hejtmii
Copy link
Author

hejtmii commented Sep 4, 2024

Sure, as you linked that config, the {name} macro resolved only to RegistrationForm but there is no macro that would allow placing the result in the same directory as the component. In the case you linked the "component library" is rather flat, but our solution structure is rather large and hierarchical. Here is an example of files and their translations I would like to work with:

/components/shared/Button/Button.tsx
/components/shared/Button/Button.cs.po
/components/shared/Button/Button.en.po

/components/richText/plugins/images/components/Image.tsx
/components/richText/plugins/images/components/Image.cs.po
/components/richText/plugins/images/components/Image.en.po

/apps/assets/components/Image.tsx
/apps/assets/components/Image.cs.po
/apps/assets/components/Image.en.po

And I would like to keep the translation dictionaries separate for components named the same, just placed in different parts of the app, and keep the PO files close to the source they belong to

In this simple example I could register 3 catalogs, but in our case there are hundreds of such components and app parts at various levels of hierarchy

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

No branches or pull requests

2 participants