Welcome Guest, Not a member yet? Register   Sign In
Retrive lang string from URI Language Identifier
#1

[eluser]John-Doe[/eluser]
Hello,

Im using URI Language Identifier (https://github.com/EllisLab/CodeIgniter/...Identifier). I have set up so the URL changes right, like following:

http://example.com/fi/test
http://example.com/en/test
http://example.com/de/test

The following is in my config file:
Code:
$config['language'] = 'english';

/* default language abbreviation */
$config['language_abbr'] = 'en';

/* set available language abbreviations */
$config['lang_uri_abbr'] = array('en' => 'english', 'sv' => 'swedish', 'fi' => 'finnish');

/* hide the language segment (use cookie) */
$config['lang_ignore'] = FALSE;

In application/core I have the file MY_Lang.php with the code:
https://github.com/EllisLab/CodeIgniter/...Identifier (application/core/MY_Lang.php)

But how should I retrive the "fi", "en" or "de" param? I have tried the following - which is stated on the GITHUB page - in my controller:
Use the $config['language'] value or $config['lang_abbr'] to determine the active language when loading your application or module.

With the above codes I get:
Code:
Severity: Notice

Message: Undefined variable: config

Filename: controllers/register.php

Line Number: 16

I have also tried $this->config->item('lang_uri_abbr'); which is stated in this Stackoverflow thread:
http://stackoverflow.com/questions/13237...identifier This generates an array with all the short codes for the language, but not the active language.

How do I retrieve the language param?
#2

[eluser]John-Doe[/eluser]
I went with this as a solution instead: https://github.com/EllisLab/CodeIgniter/...ation-i18n

Works flawless!




Theme © iAndrew 2016 - Forum software by © MyBB