Create a language file helloworld.php at “admin\language\en-gb\extension\module\“, here en-gb is English language folder but if your store is multi language then you have to create helloworld.php in other folder also like at “admin\language\OTHER_LANGUAGE_FOLDER\extension\module\“.
Now in helloworld.php you will define variable that holds the text for that language. Starting defining variable with $_[‘YOUR_VARIABLE_NAME’] and assign the text for that language.
$_['language_variable'] = 'Text for this language';
Now in controller you can do following:
$data['view_variable'] = $this->language->get('language_variable');
In the view you will show the text as:
<?php echo $view_variable; ?>
Like this way, In the view, you will be able to access the text from the language that the controller file stored as a PHP variable.
For our helloworld module of OpenCart module development, following are the needed text and I have assigned to those variables.
* Created by PhpStorm.
* User: rnepali
* Date: 10/2/2016
* Time: 1:45 PM
$_['heading_title'] = 'Hello World Module';
$_['text_extension'] = 'Extensions';
$_['text_success'] = 'Success: You have modified Hello World module!';
$_['text_edit'] = 'Edit Hello World Module';
$_['entry_name'] = 'Enter the Hello World';
$_['entry_title'] = 'Heading Title';
$_['entry_status'] = 'Status';
$_['error_permission'] = 'Warning: You do not have permission to modify Hello World module!';
$_['error_name'] = 'Module Name must be between 3 and 64 characters!';