Saturday 15 May 2010

php - How to use multiple languages in one view in CodeIgniter? -


For example, I would load it as language (BTW. I think only the first of these two, the other in English Will be ignored):

  $ this-> lang- & gt; Load ('module_messages', 'english'); $ This- & gt; Lungs-> Load ('module_message', 'check');   

But I can only use something like this:

  this $ $ echo-> lang- & gt; Line ('language_key');   

This does not work:

  $ echo-> lang-> line ('language_key', 'english');   

Any ideas how to resonate both of the language translations in one view at the same time:

  this $ echo-> lang- & gt; ; Line ('language_key', 'english'); Copy $ this- & gt; Lang- & gt; Line ('language_key', 'check');   

How to get such a thing? Unfortunately there is no way to do this because the key is loaded for a language file.

is. This is not specific to loading multiple files.

However, there is a way around it and it is to use a prefix like this:

  $ this-> lang - & gt; Load ('en_module_messages', 'english'); $ This- & gt; Lang- & gt; Load ('cs_module_messages', 'check'); Transcript $ this- & gt; Lang- & gt; Line ('en_language_key'); Transcript $ this- & gt; Lang- & gt; Line ('cs_language_key');   

If you name the language files and keys, then they will definitely fight. Therefore, we add the ISO language prefix for language files and line keys. So that both languages ​​should be allowed to use them both at the same time.

No comments:

Post a Comment