0

My website is aimed for three languages. Users can submit in English or Vietnamese or Myanmar languages. There submission are stored in the database, in display (1)I need to check texts in which language (2)then find the font installed at browser and display correctly.

Say my myanmar customer submit in Myanmar language, then stored in database. Once his page is loaded I need to check texts is written in English, Myanmar or Vietnam, then I find the installed font and display correctly.

The information for finding the font installed is easy to find like this or like that. But how can I know text are written in which language? Can I have a clue?

EDIT: I found one here in Quora, he detects English or not English. I think that is good enough for me.

batuman
  • 7,066
  • 26
  • 107
  • 229
  • I should use regular expression whether it is in which language? As discussed here (https://stackoverflow.com/questions/2402886/javascript-find-if-english-alphabets-only) – batuman Jun 29 '17 at 03:04

1 Answers1

1

To do so, you can use this library on github. It does a really nice job to guess the language. https://github.com/wooorm/franc

My two cents, I think you should analyse it on the Submit, and then, tag the content to a specific language somewhere in your database. It will be more efficient and fast afterward. Also, another more intense but effective solution would simply be a radio button for the user. If it's normal on your website to have many different languages in the same time, I don't find this solution that terrible too ;)

JFC
  • 575
  • 11
  • 25
  • How mobile phone detect language? Not sure you are bilingual. For me, I used two languages in my phone. I write text in both English and Vietnamese. Then both are displayed correctly in a sentence. So do they detect word by word and use font to display correctly? For example, if user uses two languages in one sentence how to display correctly. If i detect word by word and display correct font, it will be too slow to load a page, is it? – batuman Jun 29 '17 at 03:16
  • Well you can try it live! Just go there : http://wooorm.com/franc/. It evaluates the input by a ratio of probabilities. – JFC Jun 29 '17 at 03:25