Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Alternate File Configuration #64

Closed
davious opened this issue Oct 13, 2019 · 10 comments
Closed

Alternate File Configuration #64

davious opened this issue Oct 13, 2019 · 10 comments

Comments

@davious
Copy link

davious commented Oct 13, 2019

would you add support for an alternate file layout configuration?

example 1
Resources/localization.en-US.json
Resources/localization.fr-FR.json

example 2
Resources/en-US/localization.json
Resources/fr-FR/localization.json

@AlexTeixeira
Copy link
Owner

Hi,

If you think is a quite good thing, this can be an improvement.

Today if the same key is found, the value is not considered. I can change the code to merge values instead.

@AlexTeixeira
Copy link
Owner

Hi,

After a look it should work.
Do you want to filter the loaded files from culture ?

@bluee
Copy link

bluee commented Nov 12, 2019

I came across this thread and looking for a similar way to load json files that allows sharing of translated files with frontend libraries such as ngx-translate.

They store files in i18n/{locale}.json format eg. i18n/en-US.json

Sample JSON file:

{
  "Area": {
    "TITLE": "Bonjour Angular avec ngx-translate !",
    "SELECT": "Changer la langue"
  }
}

@AlexTeixeira
Copy link
Owner

Hi,

Yep, currently it's impossible to have this format.
You need to provide the Culture.

To add this feature, this is a huge work in the JSON file loading process.
Currently, I can't do it, I don't have enough time.

@amarcobal
Copy link

Hi @AlexTeixeira,
I'm interesting in using this alternate config, separating JSON files by language.

We are working with this format:

View1.json

{
  "text_1": {
    "Values": {
      "en": "Englisht Text 1",
      "es": "Spanish Text 1"
    }
  },
  "text_2": {
    "Values": {
      "en": "English Text 2",
      "es": "Spanish Text 2"
    }
  }
}

We need to work with this format or similar:

View1.es.json

{
  "text_1": {
    "Value": "Spanish Text 1"
  },
  "text_2": {
    "Value": "Spanish Text 2"
  },
}

View1.en.json

{
  "text_1": {
    "Value": "Englisht Text 1"
  },
  "text_2": {
    "Value": "Englisht Text 2"
  },
}

or simpler without "Value" node:

{
  "text_1": "Spanish Text 1",
  "text_2": "Spanish Text 2"
}

It would be possible?

Thanks for considering my request.

@AlexTeixeira
Copy link
Owner

Hi,

I let this issue open. When I will have some free time to work in this feature, I will try to add this feature.

@ardegirmencioglu
Copy link

Hi,

After a look it should work.
Do you want to filter the loaded files from culture ?

Hi @AlexTeixeira,

Is this feature available? I only want to separate localization file by languages, the schema can be same.

Thanks

AlexTeixeira added a commit that referenced this issue Apr 25, 2020
@AlexTeixeira
Copy link
Owner

Hi everyone,

The version 3.0.0-preview1 will have the I18n file configuration.
Let me know if you find an issue and something that is not compliant with the needs.

I will set the release in final after your feedbacks.

@amarcobal
Copy link

Hi @AlexTeixeira

Great news!
I will test the change and I will give you feedback.

Thanks

@7amou3
Copy link

7amou3 commented Nov 29, 2020

Hi,
is it possible to configure each json file per local?
found it in the frontpage 😅
why this issue still open tho?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants