0

I have a requirement something like I have languages json file such as da-DA.json de-DE.json in my assets folder inside i18n directory in which the language mapping is written. Now I want a dropdown where I can have my users select these languages. But I'm facing challenge to map it to my component. I saw these answers which states it is not possible to do so in the following links link1 link2

So I wanted to know which is the right way to achieve something like this.

nopassport1
  • 1,821
  • 1
  • 25
  • 53
Karthik Saxena
  • 768
  • 3
  • 9
  • 25
  • You need to import `json` data in your component and display it in `select` dropdown using `ngFor`. See this [answer](https://stackoverflow.com/a/48876138/11719787) to import json file in component/ts – Sameer Jan 16 '20 at 09:14
  • I just want filenames from that i18n directory in my assets folder not the content from the json files – Karthik Saxena Jan 16 '20 at 10:46
  • 1
    You can't access **files** or **file names** (Basically a file system) using front end frame-work or javascript. The above links you provided already answered for this question. – Sameer Jan 16 '20 at 11:01
  • 1
    I have a project where we do that exactly. We use this library https://github.com/ngx-translate/core It's worth checking it out. – alexortizl Jan 16 '20 at 20:05

0 Answers0