wooorm / franc

Natural language detection

Home Page:https://wooorm.com/franc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there json data with language codes and names

d668 opened this issue · comments

commented

I am building an HTML dropdown and I need pairs like

{"cmn":"Mandarin Chinese","spa":"Spanish","eng":"English"....}

Can't find it anywhere except readme.md

Thanks

commented

hm, did a parser

            var codes = new WebClient().DownloadString(
[codes-json.txt](https://github.com/wooorm/franc/files/3124655/codes-json.txt)

"https://raw.githubusercontent.com/wooorm/franc/master/packages/franc/readme.md").Split('\n')
                .Where(x => x.StartsWith("| [`"))
                .Select(x => new
                {
                    code = x.Split('`')[1],
                    name = x.Split('|')[2].Trim()
                });
            var json = JsonConvert.SerializeObject(codes);
            File.WriteAllText("codes.json ", json);                

Attached a file if someone needs

commented

Yep, crawling would work, or you could use iso-639-3. See also GH-61.