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

[React] Customized namespaces path #337

Open
mwskwong opened this issue Nov 22, 2019 · 4 comments
Open

[React] Customized namespaces path #337

mwskwong opened this issue Nov 22, 2019 · 4 comments

Comments

@mwskwong
Copy link

I know I can set the load path of namespaces like this:

{
    loadPath: "/locales/{{lng}}/{{ns}}.json"
}

In the case of React, it is located in public/locales.

However, can I set it to src/assets/locales?

@jamuhl
Copy link
Member

jamuhl commented Nov 22, 2019

Technically you can set it to whatever you like...your server just has to make the files available from that route...(be it webpack devserver or your production server...it's a http request and nothing fancy)

@mwskwong
Copy link
Author

The problem is, after the compilation of create-react-app the actual path will be different.
e.g. My logo which used to be in src/assets/images/logo.svg, now is located in static/media/logo.4c6bacf1.svg.

@jamuhl
Copy link
Member

jamuhl commented Nov 22, 2019

you can set the paths based on isProduction or not...

@jamuhl
Copy link
Member

jamuhl commented Nov 22, 2019

and you're talking about bundling...that's different from providing translations on a server...public/locales is nothing than webpack developer server hosting those files in public...

importing an svg is bundling the svg with your app...

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