Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Lang configuration with DB
skaterik
July 2014
Hi All
:)
I have a problem configuring the Lang with DB. I have created the table as the Docs.
I have added in config.php this line:
'language' => array('lang.db')
After that i set my desired language in the controller:
Config::set('language','es');
I have this line in DB Table:
INSERT INTO `lang` (`identifier`, `language`, `lang`, `hash`) VALUES
('inicio', 'es', 'Inicio', 'hash');
And i try to get a line with:
Lang::get('inicio')
But it always return NULL, my table name is 'lang'.
What i'm doing wrong?
skaterik
July 2014
I forget to say that in my controller i set the lang with:
Config::set('language','es');
Harro
July 2014
Language runs in the request context, so it depends on where you have used
Lang::get('inicio');
And where you have loaded it. So a bit more information is needed.
skaterik
July 2014
The
Config::set('language','es');
is used in my controller (action_index at the moment for testing).
And the
Lang::get('inicio')
Is used in the View directly " echo Lang::get('inicio') "
Besides that, what is the purpose of "hash" column in the Db?
The 'language' => array('lang.db') is in app/config/config.php
skaterik
July 2014
Ok, I get It.
I did not know that the data is need be serialiced before save.
Harro
July 2014
And you need to load it before you can use it. Language data isn't loaded automatically.
skaterik
July 2014
Thanks Harro, now I understand how it works.
Harro
July 2014
Accepted Answer
Cool. Happy coding!
;-)
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,089
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
261
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
July 2014
skaterik
July 2014