toonvanstrijp / nestjs-i18n

The i18n module for nestjs.
https://nestjs-i18n.com
Other
642 stars 106 forks source link

How to use single en.json file #482

Closed matzeso closed 11 months ago

matzeso commented 1 year ago

Hey there, I currently have only a single JSON file per language. Unfortunately, if I just add the en.json into the i18n folder it won't get picked up. If I add it into en/en.json, all keys are prefixed with en. Is there any way that I can use just a single JSON with the current JSON loader, without the keys getting prefixed by the filename?

Any hint is much appreciated :-)

Best regards, Matthias

tamzid-skavl commented 1 year ago

Same here. Initially I thought it can be achieved by having a custom loader. but it turns out, it can't be.

Susccy commented 1 year ago

It can absolutely be achieved using a custom loader. What makes you think it can't?

toonvanstrijp commented 1 year ago

@tamzid-skavl, @Susccy is right this definitely can be achieved by creating a custom loader. The reason things get prefixed by their file name. That way you'll never have collisions in your translations keys.

rubiin commented 11 months ago

Marking this as solved. Feel free to reopen if the suggested stuffs don't work out