File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010This plugins provides:
1111
1212- Route class for generating and matching urls with language prefix.
13+ - Middleware (dispatcher filter or CakePHP < 3.3) which sets ` I18n::locale() `
14+ based on language prefix in URL and also provides redirection to appropriate
15+ URL with language prefix when accessing site root.
1316- Class for retrieving translation messages stored in database instead of po/mo files.
1417- Validation class for auto translating validation message.
1518- A widget to generate select box with list of timezone identifiers.
@@ -93,6 +96,23 @@ files and populate the translations table. Updating the db records with
9396translations for each language is upto you. Having the messages in a table
9497instead of files make it much to make a web interface for managing translations.
9598
99+ ### I18nMiddleware
100+
101+ You can setup the ` I18nMiddleware ` in your ` src/Application::middleware() ` as
102+ shown:
103+
104+ ``` php
105+ $middlware->add(new \ADmad\I18n\Middlware\I18nMiddleware([
106+ 'defaultLanguage' => 'en',
107+ 'languages' => [
108+ 'en' => ['locale' => 'en_US'],
109+ 'fr' => ['locale' => 'fr_FR']
110+ ],
111+ ]));
112+ ```
113+
114+ The keys of ` languages ` array are the language prefixes you use in your URL.
115+
96116### TimezoneWidget
97117
98118In your ` AppView::initialize() ` configure the ` FormHelper ` to use ` TimezoneWidget ` .
You can’t perform that action at this time.
0 commit comments