We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

get language key based on language pack? | Forum

Topic location: Forum home » Support » General Questions
Marcus
Marcus Nov 22 '17
My site is set to Spanish how to get language key from from english key?

OW::getLanguage()->text('base', 'questions_question_relationship_label') Need this retrieve english value? How to add that variable?
Senior Developer Leader
Senior Developer Nov 23 '17

Hi Marcus!


You can do this:


BOL_LanguageService::getInstance()->getText(1, 'base', 'questions_question_relationship_label');


The number 1 is the language id, english is the default language and its ID is 1.


With this method you can get the text directly if the key 'questions_question_relationship_label'

Just be careful, if you try this with an inexistent key, you will have an error in your website.


Senior Developer.

Marcus
Marcus Nov 25 '17
Senior Developer thanks so much that works great!