Comments (8)
Hi there!
Repetitive translations can be shared in src/locales.
As for the feature-specific translations, they can live in their corresponding feature folders and utilize the namespaces feature of i18next.
from bulletproof-react.
Hi @alan2207, many thanks for your replay.
If I got what you said, then:
Feature a
Locales
src/features/a/locales/en/a.json
src/features/a/locales/it/a.json
Usage
t("a:key") or t("key", { ns: "a" })
Feature b
Locales
src/features/a/locales/en/b.json
src/features/a/locales/it/b.json
Usage
t("b:key") or t("key", { ns: "b" })
But what about nested features? How would you handle them?
Feature b (nested inside a)
Locales
src/features/a/features/b/locales/en/???.json
src/features/a/features/b/locales/it/???.json
Usage
t("???:key") or t("key", { ns: "???" })
How would you replace ??? with?
Many thanks again,
Mauro
from bulletproof-react.
Maybe we shouldn't nest features after all. It could make things more complicated in the longer run. I just updated the docs that were recommending it. If you still think it makes your work easier, feel free to nest, but generally, that would be unnecessary.
from bulletproof-react.
@alan2207 thanks for the reply.
What about features depending on other features?
From the routing point of view I have situations such
{APP_URL}/a-entities/{id-a-entity}/b-entities/{id-b-entity}/c-entities/{id-c-entity}
I am tempted to organize things in the following way
/src/features/a/features/b/features/c
Is it better to have one one level also in this situation?
/src/features/a
/src/features/b
/src/features/c
What do you think?
Cheers,
Mauro
from bulletproof-react.
It really depends on the application.
Imagine a social network where you can have users, posts, images, videos, comments, etc.
If it were required that only posts had comments, then I would probably keep comments as part of the posts feature and not extract them into a separate feature.
But if we were required to have comments for posts, images, and videos, it would make sense to have a comments feature as a standalone feature that is compatible and used with posts, images, and videos.
from bulletproof-react.
@alan2207 thanks.
Ok, then I would have only feature A and, in the future, if features B o C are needed elsewhere then I can extract them.
Correct?
Many thanks.
Mauro
from bulletproof-react.
Exactly! Start with the main features of your application and put everything related there. Then you can break it up further once you notice something should be extracted. It doesn't need to be used elsewhere to be a feature, but it needs to solve the business problems of the application. I would suggest you check out domain-driven design and development to get more info and develop intuition about when something should be extracted.
from bulletproof-react.
Thank you!
from bulletproof-react.
Related Issues (20)
- Could not start on the latest version of node
- STRUCTURE - Where to store static data? HOT 1
- Logout Functionality Not working Properly - DUC-3
- suggestion for pagination
- Network Error when sign up or login? HOT 2
- Question : How to make drawer globally? HOT 3
- Where must I put these files? [React, React Native] HOT 1
- Why we need to use number for createdAt in BaseEntity class HOT 3
- CRA is unmaintained HOT 3
- Avoid barrel files
- Update react-router usage
- [minor]: Typo in ~/README.md HOT 2
- Missing Link/Example in Global Store Management
- Some links are Not found HOT 1
- Auth flow does not work with new cookies
- Logo/Mascot idea :) HOT 1
- .env validation on build
- Not sure the Validation Example Code link is going to the right place HOT 1
- rimraf and glob are deprecated
- Documentation discrepancy HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bulletproof-react.