php - multilanguage database driven website with laravel4 -


im messing around laravel multilanguage website.

i trying implement this:

$languages = array('en','fr'); $locale = request::segment(1); if(in_array($locale, $languages)){     \app::setlocale($locale); }else{     $locale = null; } route::group(array('prefix' => $locale), function() {      route::get('/', 'homecontroller@index');     route::get('contact', 'homecontroller@contact');  }); 

for can see, everythings works fine, understand, laravel take locale url segment, check if it's in languages, if not null change routing adding prefix. have 2 question:

1) why images not showed anymore, when go en/contact, while when go en/ can see them.

2) use database pick languages, don't necessarly have change app:setlocale, need model extract language database , put in right place?

3) how pass variable languages blade, can change description of product?? (i used ?lang=en , take $_get

sorry know maybe basic question, come pure php , pure mysql background.

edit: 1) need use html:: image facade {{html::image('path')}}

  1. to me seems linking images relative paths break when start have different structure in url. try having absolute url:s in image src tags or make them start slash (/). e.g. {{ html::image('/absolute/path/to/image.jpg') }}

  2. i'm not sure if understand question, want store translations in database instead of in files default? maybe you: https://github.com/waavi/translation

  3. this doable in lot of different ways. example call {{{ request::segment(1) }}} in blade template , language (assuming it's segment number 1). neatest way wrap in function , put in appropriate place according application's structure.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -