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

Split up language files #11

Closed
mwillems1994 opened this issue Jul 31, 2020 · 1 comment
Closed

Split up language files #11

mwillems1994 opened this issue Jul 31, 2020 · 1 comment

Comments

@mwillems1994
Copy link

mwillems1994 commented Jul 31, 2020

I was wondering how and if i can split up language files. For an example i would like to have the following folder structure:
locales/Controllers/Home/en.json
locales/Models/Home/en.json
locales/Services/Home/en.json

Is that possible? The default localisation .net Core offers, tries to guess where the localisations files are based on the path of the actual cs file. Unfortunately i am unable to figure out how it works with this library.

@mwillems1994 mwillems1994 changed the title Split ut Split up language files Jul 31, 2020
@DarkLiKally
Copy link
Owner

Not with the default providers, the default json file backend expects a structure like
locales/{language-code}/{namespace}.json

but you can easily implement your own backend - inspired by the default josn backend - which handles your custom structure.
also if you want to do custom namespace resolving from the string localizer generic context - you should be able to easily implement a custom one for your scenario which uses the typeof(T) information to automatically retrieve the translation namespace from the .net namespace.

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