xfra35 / f3-multilang

Create multilingual apps with this localization plugin for the PHP Fat-Free Framework
GNU General Public License v3.0
48 stars 13 forks source link

Lang selector as not a part of the URL #13

Closed Kekesed closed 8 years ago

Kekesed commented 8 years ago

Hi, i hope that the url format is not /xx/user but /user?lang=xx. and then, the ?lang=xx is can be removed as it was saved into cookie. So user can acces other page on the same Language.

Eg. /about without need to specify ?lang=xx again after accessing /user?lang=id (User no need to access this way: /about?lang=id.

Thankyou!!

xfra35 commented 8 years ago

Hi, That's not possible with the plugin, as it is focused on producing SEO-friendly multilingual URIs.

But you don't really need a plugin for that case, do you? This should be as easy as including the following snippet in your index.php:

if ($f3->exists('GET.lang'))
  $f3->copy('GET.lang','COOKIE.lang');
if ($f3->exists('COOKIE.lang'))
  $f3->copy('COOKIE.lang','LANGUAGE');

Anyway, one day I may refactor the plugin to make it less restrictive.

Kekesed commented 8 years ago

hmm looks like so... And then, i could just use a definition file for the strings? and then include them as language specified? :laughing: :laughing:

Thanks anyway

xfra35 commented 8 years ago

If you're talking about localization, F3 handles that already. See here. Just set LOCALES to the location of your dictionary files.

Kekesed commented 8 years ago

ohh yup, i've read it this morning hahha, forgot to close this. Thanks! You're such a big help!