Welcome Guest, Not a member yet? Register   Sign In
Main language file?
#1

[eluser]Kunzilla[/eluser]
Hi,

can i create a main-language-file? I created a folder in /language/myLang/ and i want so create an general-langfile for misc stuff.

Thanks!
#2

[eluser]InsiteFX[/eluser]
You can create it, but it has to go under the language name folder.

application/language/english/

and the file has to be named filename_lang.php

Do not use MY_ it is a CodeIgniter reserved word for extending Classes and Helpers!

InsiteFX
#3

[eluser]Kunzilla[/eluser]
Thanks for your answer. But i have two questions.

But how can i include that file?
How must be the filename?

I use user_lang.php for the user-module, but i want to create a file for misc translations... form-elements, logout-button etc. Values for global elements.

U understand what i mean?


Thanks for your help!
#4

[eluser]InsiteFX[/eluser]
if you look in system/language/english you will see that there already is a form_validation_lang.php file.
Just copy a language file and make the changes for your new file.

You can create your own language files but you will have to create one for every language that you use.

application/language/english/filename_lang.php
Code:
$lang['your_key'] = "your_text";

InsiteFX
#5

[eluser]Kunzilla[/eluser]
I've now create the filename_lang.php (the real filename) an it doesnt work. Any idea? The language is selected in the autoload file.
#6

[eluser]InsiteFX[/eluser]
Do not use filename_lang create your own filename but it has to end with _lang.php and be in the language/
directory like application/language/english/file_lang.php
Code:
$lang['language_key'] = "The actual message to be shown";

// to use autoload or load it!
$this->lang->load('filename', 'language');

// to use
$tmp = $this->lang->line('language_key');
echo $tmp;

Did you read the CodeIgniter User Guide - Language Class?

InsiteFX
#7

[eluser]Kunzilla[/eluser]
oooohhh. Sorry! It worked now... i forget to put it into the $autoload['language'] array.

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB