jsakamoto / Toolbelt.Blazor.I18nText

The class library that provides the ability to localize texts on your Blazor app!
Mozilla Public License 2.0
247 stars 25 forks source link

Question for a good structure of json files #57

Closed monderino closed 2 years ago

monderino commented 2 years ago

Hi,

we use this cool library for al lot of time now and it saved a lot of time. Thank for that 👍🏻

But over time our json files with all translation in it got quit big and is hard to maintain. Is there any way or idea to organize them in a cool way?

For example:

Thank you and best regards Sven

jsakamoto commented 2 years ago

Hi @monderino,

It depends on the cases, but in my opinion, "split the files into multiple files" might be a better solution generally.

When a Blazor app has multiple components, it is a good idea to create localized text source JSON files for each of them.

For example, when the Blazor app has two components of the "Foo.razor" and the "Bar.razor", please consider creating two localized text source JSON files of the "i18ntext/FooText.xx.json" and the "18ntext/BarText.xx.json". This design means it is better that describing the "Foo.razor" specific text in the "FooText.xx.json" and describing the "Bar.razor" specific text in the "BarText.xx.json". Those localized text sources are compiled into each of the Typed Text Table classes ("class FooText" and "class BarBar"). Finally, refer and use the "FooText" Typed Text Table class from the Razor component "Foo.razor", refer and use the "BarText" Typed Text Table class from the Razor component "Bar.razor".

This is one of the practices to organize localized text source JSON files effectively.

I hope the suggestion above will be helpful for you.

monderino commented 2 years ago

Hi @jsakamoto,

Thank you very much. I will do that.