Is it possible to have multiple messges files for a language? #3402
Replies: 2 comments 7 replies
-
Oh and I should probably add that even if I use the mentioned configuration from the link, something like this:
I receive an error saying:
So I assume multiple files per language are not there at all? |
Beta Was this translation helpful? Give feedback.
-
You could implement a plugin that uses globs or make a PR to this plugin and use node's fs.glob function. Why do you want to to split the messages per component? The only technical reasons why historically this has been done is to manually tree-shake. That is not needed with Paraglide JS. Good practice is to not optimize the structure of the message files at all. Everyone on the team needs to follow the same rules even across an org e.g. designers, translators, auditors. |
Beta Was this translation helpful? Give feedback.
-
I'm currently evaluating inlang and ParaglideJS for my future projects. In component based frameworks, I'd like to have everything related to a component in the same folder. Is it possible to set this up with the messages somehow?
Basically, if I delete a folder of a component, it should delete all related stuff - so I'd like to be able to put the messages JSON files in the folder for the component if it needs some texts on it.
I have read about namespaces, but I wouldn't even need this: I would be fine with this just picking up all
messages-{lang}.json
files in all subfolders and merging them together under the hood...I've seen https://inlang.com/m/ig84ng0o/plugin-inlang-json#settings but the
pathPattern
doesn't allow for example./src/components/**/_messages/{languageTag}.json
because the**
are not interpreted as globs.What I'd like to have:
Is there a way to be able to do this without having to hardcode all components / their messages paths?
In SvelteKit, I would probably like to have a "per route" messages as well...
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions