Giter VIP home page Giter VIP logo

Comments (8)

alan2207 avatar alan2207 commented on August 15, 2024

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.

mauro-ni avatar mauro-ni commented on August 15, 2024

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.

alan2207 avatar alan2207 commented on August 15, 2024

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.

mauro-ni avatar mauro-ni commented on August 15, 2024

@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.

alan2207 avatar alan2207 commented on August 15, 2024

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.

mauro-ni avatar mauro-ni commented on August 15, 2024

@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.

alan2207 avatar alan2207 commented on August 15, 2024

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.

mauro-ni avatar mauro-ni commented on August 15, 2024

Thank you!

from bulletproof-react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.