Welcome Guest, Not a member yet? Register   Sign In
Multilanguge site
#1

[eluser]sojic[/eluser]
There is a lot of multilanguage threads, but I did not find proper thread to post there.

Sorry again, but....

I developing multilanguage site. I extend controller with i18n (http://codeigniter.com/wiki/Category:Int...iews_i18n/).

I user also dx_auth library (form_validator....).

Dx_auth messages are in application/language/english/dx_auth_lang.php. I make new folder in application/language/macedonian/, copy dx_auth_lang.php, translate it... but how to load this file?

Also.... I want to create my own language file (for my application some standard sentences)... How to "handle" with this files?

I have read http://ellislab.com/codeigniter/user-gui...guage.html but it did not help me.
#2

[eluser]sojic[/eluser]
Anybody to help?
#3

[eluser]jaswinder_rana[/eluser]
I am new to this, so I'll share what I understand.

Languages files are

- System/language/{LANGUAGE} (english, german etc.)
- System/application/language/{LANGUAGE}

DX_Auth is at System/application/language/dx_auth_lang.php

YOUR file will go at System/application/language/{YOUR FILE}_lang.php (Notice that _lang.php MUST be there.

Then in your controller you can specify $this->load->language('{YOUR FILE}') (WITHOUT _lang.php)

IF your language will be for WHOLE application and you ALWAYS want to load it then put it in application/config/autoload.php like

$autoload['language'] = array('{YOUR_FILE}');

Try to make your language keys unique like

in application/language/english/{YOUR_FILE}_lang.php

$lang{'MY_something1'} = 'Something 1';
$lang{'MY_something2'} = 'Something 2';

Note the use of MY_

I am assuming (not really sure) that if you don't have it unique then it may overwrite some other language key which may already have been defined.

Now, you can use it like


$this->lang->line('MY_something1');


Hope this helps

EDIT: There maybe some syntax errors as I just wrote this off the top of my head. So, I might be wrong with some object names but the way it works is right (I think)
#4

[eluser]sojic[/eluser]
Unable to load the requested language file: language/mk_lang.php

The file is in system/language and in system/application/language
#5

[eluser]jaswinder_rana[/eluser]
File has to be in

system/language/english/mk_lang.php

OR (preffered for personal files)
system/application/language/english/mk_lang.php

I think you are missing one folder (or maybe posted it wrong)
#6

[eluser]sojic[/eluser]
Is it possible to organize language files like this:

/system/application/languages/
english/contact_lang.php
english/about_lang.php
macedonian/contact_lang.php
macedonian/about_lang.php
#7

[eluser]jaswinder_rana[/eluser]
Sure. In this case "macedomain" will be treated as different language.

You can provide a way for users to change language. Default language can be changed in system/application/config/config.php with
$config['language'] = "english";
#8

[eluser]sojic[/eluser]
How to change config language from code in controller?

I user i18n as controller for controllers.
#9

[eluser]jaswinder_rana[/eluser]
http://ellislab.com/codeigniter/user-gui...guage.html
#10

[eluser]bgougent[/eluser]
I remember having some problems when the language was defined in the config.php

My solutions was to set the language in the session. If the entry was not created, my default language was english. Otherwise I loaded the language from the session.
Place to load the language was in the contsructor.




Theme © iAndrew 2016 - Forum software by © MyBB