infotechnohelp/cakephp-core

Plugin for CakePHP 3

Installs: 415

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:cakephp-plugin

dev-master 2019-03-29 10:01 UTC

This package is auto-updated.

Last update: 2024-10-29 05:40:39 UTC


README

  • Create JS locale files in webroot/js/Locale/en_US.js

Terminal: bin/cake locale js (All files) || bin/cake locale js en_US (Concrete language)

  • LocaleManager

src/Locale contains et_EE, en_US is a default locale

LocaleManager::getLanguageCodes() => ['en_US', 'et_EE']

LocaleManager::getLanguageLabels() => ['ENG', 'EST']

LocaleManager::getLanguageLabels(['en_US' => 'US']) => ['US', 'EST']

  • LanguagesComponent

$controller->loadComponent('Languages.Languages') sets cookie language and I18n locale

Set language cookie and I18n locale with GET query parameter lang=en_US or writing directly to Cookie.language

  • Language routing

demo redirects to en/demo (Default locale is en_US)

demo?lang=et_EE redirects to et/demo?lang=et_EE

en/demo?lang=et_EE redirects to et/demo?lang=et_EE