File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,6 +86,30 @@ $query2 = $statement->build();
8686var_dump($query2); // outputs string(19) "SELECT * FROM "b" "
8787```
8888
89+ ## Localization
90+
91+ You can localize error messages installing ` phpmyadmin/motranslator ` version ` 3.0 ` or newer:
92+ ``` sh
93+ composer require phpmyadmin/motranslator:^3.0
94+ ```
95+
96+ The locale is automatically detected from your enrivonment, you can also set a different locale
97+
98+ ** From cli** :
99+ ``` sh
100+ LC_ALL=pl ./vendor/bin/lint-query --query " SELECT 1"
101+ ```
102+
103+ ** From php** :
104+ ``` php
105+ require __DIR__."/vendor/autoload.php";
106+
107+ $GLOBALS['lang'] = 'pl';
108+
109+ $query1 = "select * from a";
110+ $parser = new PhpMyAdmin\SqlParser\Parser($query1);
111+ ```
112+
89113## More information
90114
91115This library was originally created during the Google Summer of Code 2015 and has been used by phpMyAdmin since version 4.5.
Original file line number Diff line number Diff line change 1717 },
1818 "require" : {
1919 "php" : " >=5.3.0" ,
20- "phpmyadmin/motranslator" : " ~3.0" ,
2120 "ext-mbstring" : " *"
2221 },
2322 "require-dev" : {
23+ "phpmyadmin/motranslator" : " ~3.0" ,
2424 "phpunit/php-code-coverage" : " ~2.0 || ~3.0" ,
2525 "phpunit/phpunit" : " ~4.8 || ~5.1"
2626 },
27+ "conflict" : {
28+ "phpmyadmin/motranslator" : " <3.0"
29+ },
30+ "suggest" : {
31+ "phpmyadmin/motranslator" : " Translate messages to your favorite locale"
32+ },
2733 "bin" : [
2834 " bin/highlight-query" ,
2935 " bin/lint-query"
Original file line number Diff line number Diff line change @@ -58,6 +58,10 @@ public static function load()
5858 */
5959 public static function gettext ($ msgid )
6060 {
61+ if (!class_exists ('\PhpMyAdmin\MoTranslator\Loader ' , true )) {
62+ return $ msgid ;
63+ }
64+
6165 self ::load ();
6266
6367 return self ::$ translator ->gettext ($ msgid );
You can’t perform that action at this time.
0 commit comments