Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Most effective way working with multiple natural languages

I am currently working with a codeigniter PHP based application and have come to the point where it's about to go off with multiple languages.

Is codeigniters own language class the most effective way to handle languages? Is there any specific language-tools/libraries that are commonly used in PHP apps?

Thanks!

like image 260
Industrial Avatar asked Apr 30 '10 17:04

Industrial


People also ask

What is the best natural language processing?

The Top 10 NLP Tools. MonkeyLearn | NLP made simple. Aylien | Leveraging news content with NLP. IBM Watson | A pioneer AI platform for businesses. Google Cloud NLP API | Google technology applied to NLP.

Can NLP be applied to multiple languages?

NLP is usually used for chatbots, virtual assistants, and modern spam detection. But NLP isn't perfect, although there are over 7000 languages spoken around the globe, most NLP processes only use seven languages: English, Chinese, Urdu, Farsi, Arabic, French, and Spanish.

What is multilingual natural language processing?

Multilingual NLP (Natural Language Processing) is a technology that incorporates linguistics, computer science, and artificial intelligence to process and analyse large amounts of natural human language in various contexts.


2 Answers

I've never used CI_Language but it appears to use language arrays to do the translation.

Overly simplified example of this type method:

$trans = array(
    'MAIN_TITLE' => 'Title Here'
);

echo $trans['MAIN_TITLE'];

Personally I find this really annoying because you're then editing views that are cluttered with array key names instead of useful text. Which can be quite annoying at times. Not to mention you have to remember which keys correlate to which strings if you are using them in multiple places.

I use Gettext which I find much easier. You just have to wrap your strings with the translate method: _(). Then once you're done with your app, you open up PoEdit and create the new language file. PoEdit will parse all of my source files looking for strings wrapped like this <?php echo _('Title here') ?> and insert them into the .po language file. You can then go string by string and translate the text easily within PoEdit. The benefit of this is you have the source translation right there within PoEdit, instead of a meaningless array key name in some include file

This all makes my life much easier in that I can update my language files every Friday with one click. Any new or modified translations will automatically be added to my language file, and any unused translations will automatically be removed. I send the files off to my 3 international branchs for translation, and my changes and updated language files are ready to be deployed Monday morning

like image 60
Mark Avatar answered Oct 01 '22 21:10

Mark


You may want to have a look into php intl library. http://php.net/intl

like image 44
Srikanth Avatar answered Oct 01 '22 20:10

Srikanth