Codeigniter get keys of language-files
I'm running into a I18N-problem here.
I have a database with several variables stored. (e.c. mod_sales)
To make my site I18N-a开发者_JAVA技巧ble I'm using the language-class of CI-framework to read a line of a language-file (e.c. $this->lang->line('mod_sales'); ).
This will return me the value of that language-variable out of the language-file
(e.c. $lang['mod_sales'] = "Sales";) or in german ($lang['mod_sales'] = "Verkauf"; )Now here's the problem: I'm trying to reverse that procedure to get the key-value of that lang-array. Say I'm running my site in german and searching for "Verkauf" I wanna get "mod_sales" - exactly the same as if I'd run the site in english and would search for "sales".
Is there any implemented method to get there, or do I have to handle this by array-functions (if thats even possible)?
I found it out (with help of CI-Guys from http://webchat.freenode.net/ #codeigniter):
I can access the array by using $var = $this->lang->language.
Now I can use array_search("val",$var); to get the key for that value.
精彩评论