To access language items within a language file, we can do:
$this->EE->lang->loadfile('file_name');
$this->EE->lang->line('item_short_name');Is there a best-practice way to reverse the second item, something like:
$this->EE->lang->line('Long Name');so that I can get the short name for a language item from the long name. I know I could read the file with php and parse it, but I as wondering if there is an EE-native way to do it.
You may be able to grab the language data with
$this->EE->lang->language;(or something similar). Then you can use array_search to get the key for the language line you are looking for. I have not tested it, but this may work…
$key = array_search('My Language Text', $this->EE->lang->language);Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.