Comments (3)
@jorgecoca the options featurePrefix
wouldn't work cause than you get duplicate paths.
i18n/
en_US/
intl_en_US.json
es_ES/
intl_es_ES.json
To access the translations you just use:
this.i18n.translate(intl_en_US.KEY, {lang: 'en_US'})
and
this.i18n.translate(intl_es_ES.KEY, {lang: 'es_ES'})
from nestjs-i18n.
- I agree that it could be better documented :)
- the prefix is used to save transactions in categories. (So in the design choice I made I tought it would be a good idea to save the translation per domain and have a file for each domain of transactions)
- I don't get this one sorry, cause you can still access both translations by using the path right?
I'm open to any solutions to make this a better library. So if you could clarify this we could probably make some changes in the documentation or design to solve this.
from nestjs-i18n.
Once I posted the message, I understood that adding the prefix in there was to allow us to have "feature/domain" translations, but the fact that it is hidden in the "string ID" that you want to provide, and not by an API, seems weird to me.
Maybe as part of the options
object in the translate
method? e.g. (see featurePrefix
)
public translate(
key: string,
options?: {
lang?: string;
args?: Array<{ [k: string]: any } | string> | { [k: string]: any };
featurePrefix?: string;
},
)
PS. Regarding your third bullet point, how would you access those strings if you have this folder structure, where the JSON files have the same string IDs?
i18n/
en_US/
intl_en_US.json
es_ES/
intl_es_ES.json
from nestjs-i18n.
Related Issues (20)
- Unit Test Failure: TypeError with NestJS-i18n Injection
- [GraphQL] Exception in I18nValidationPipe HOT 1
- Update to 10.4.0 breaks apollo subscriptions
- TypeError when using disableMiddleware with I18nValidationExceptionFilter
- Best practices for using this.i18n.t() vs I18nContext.current().t() HOT 4
- How o disable the log of: WARN [I18nService] context type: necord not supported
- "parsing translation error - { stack: [ {} ] }" in application logs on start
- for people who face: typeerror: cannot read properties of undefined (reading 'pipe')
- DTO Validation Translations
- Does not work with Fastify HOT 2
- Translations are removed when args are not present HOT 2
- TypeError at formatI18nErrors when validating nested array of objects HOT 1
- Cant access translations in mailer over a BullJS processor
- > Hi, @toonvanstrijp I tried this approach but for some reason path parameters are not parsed in resolver. I try to read in resolver HOT 1
- ERROR [RpcExceptionsHandler] I18n context undefined HOT 1
- Opt out of class-validator
- Bug with generated types, bad property "filter" HOT 2
- throwOnMissingKey option is not working HOT 2
- Inconsistent Error Response Structure When Using I18nValidationExceptionFilter
- integration with apollo federation 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 nestjs-i18n.