Use motranslator for translating #35

Closed
wants to merge 21 commits into
from

Projects

None yet

3 participants

@nijel
Member
nijel commented Feb 24, 2016

This makes it work transparently with or without phpMyAdmin.

See also phpmyadmin/phpmyadmin#12023

Signed-off-by: Michal Čihař michal@cihar.com

@codecov-io

Current coverage is 99.17%

Merging #35 into master will increase coverage by +0.01% as of 10ac2b3

@@            master     #35   diff @@
======================================
  Files           48      49     +1
  Stmts         3481    3497    +16
  Branches         0       0       
  Methods        158     161     +3
======================================
+ Hit           3452    3468    +16
  Partial          0       0       
  Missed          29      29       

Review entire Coverage Diff as of 10ac2b3

Powered by Codecov. Updated on successful CI builds.

@nijel nijel referenced this pull request in phpmyadmin/phpmyadmin Feb 29, 2016
Open

Localization of SQL parser messages #12013

@nisargjhaveri nisargjhaveri and 1 other commented on an outdated diff Mar 1, 2016
src/Translator.php
+ *
+ * @param string $msgid String to be translated
+ *
+ * @return string translated string (or original, if not found)
+ */
+ public function gettext($msgid)
+ {
+ return $this->translator->gettext($msgid);
+ }
+
+ /**
+ * Returns the singleton Translator object
+ *
+ * @return Translator object
+ */
+ public static function getInstance()
@nisargjhaveri
nisargjhaveri Mar 1, 2016

Can't we make gettext a static method and use Translator::gettext($msg) instead of Translator::getInstance()->gettext($msg). Looks much cleaner and easier to use.

@nijel
nijel Mar 1, 2016 Member

Indeed that would be doable as well with lazy initialization of the translator (we don't need it in most cases, it's used only for errors).

@nijel nijel changed the title from Use motranslator to provide __ function to Use motranslator for translating Mar 2, 2016
@nijel
Member
nijel commented Mar 2, 2016

Thinking more about this I'm not sure if it's good idea to include this in releases used in phpMyAdmin 4.6.x as this will bring two gettext implementation into phpMyAdmin codebase....

@nisargjhaveri

If we want to think really 'modular', it shouldn't matter :P . But yes, makes sense.

How are we actually managing releases of SQL parser?

@nijel
Member
nijel commented Mar 5, 2016

It won't matter for 4.7, but for 4.6 I'm not sure if switching phpmyadmin to motranslator is reasonable...

@nisargjhaveri

Agreed.

@nijel nijel self-assigned this Sep 13, 2016
nijel added some commits Feb 24, 2016
@nijel nijel Use motranslator to provide __ function
This makes it work transparently with or without phpMyAdmin.

Signed-off-by: Michal Čihař <michal@cihar.com>
865eb2e
@nijel nijel Add script for extracting strings to po files
Signed-off-by: Michal Čihař <michal@cihar.com>
cbbcad1
@nijel nijel Ignore backup files
Signed-off-by: Michal Čihař <michal@cihar.com>
d3c98eb
@nijel nijel Update po files
[CI skip]

Signed-off-by: Michal Čihař <michal@cihar.com>
b1664f1
@nijel nijel Include mo files in the repository
Signed-off-by: Michal Čihař <michal@cihar.com>
bfcc89f
@nijel nijel Add script for generating mo files
Signed-off-by: Michal Čihař <michal@cihar.com>
b084e76
@nijel nijel Share error handling in one base class
Signed-off-by: Michal Čihař <michal@cihar.com>
26f97bc
@nijel nijel Move motranslator initialization to share core class
Signed-off-by: Michal Čihař <michal@cihar.com>
94a89e8
@nijel nijel Use translator
Signed-off-by: Michal Čihař <michal@cihar.com>
58477e3
@nijel nijel Add some translation
Signed-off-by: Michal Čihař <michal@cihar.com>
741897c
@nijel nijel Replace __( usage by Translator class
Signed-off-by: Michal Čihař <michal@cihar.com>
5f81f21
@nijel nijel Rename locales
Signed-off-by: Michal Čihař <michal@cihar.com>
79e4cda
@nijel nijel Adjust scripts to new structure
Signed-off-by: Michal Čihař <michal@cihar.com>
b259aec
@nijel nijel Require error message for error
Otherwise it's for user hard to diagnose what went wrong.

Signed-off-by: Michal Čihař <michal@cihar.com>
cb71ec9
@nijel nijel Update translations
[CI skip]

Signed-off-by: Michal Čihař <michal@cihar.com>
f94b29f
@nijel nijel Move all helper scripts to single directory
Signed-off-by: Michal Čihař <michal@cihar.com>
c6a4ff0
@nijel nijel Use static method for translating
Signed-off-by: Michal Čihař <michal@cihar.com>
95c9d8d
@nijel nijel Adjust path to generate-mo script
Signed-off-by: Michal Čihař <michal@cihar.com>
981b2d4
@nijel nijel Migrate new code to use Translator class
Signed-off-by: Michal Čihař <michal@cihar.com>
3bad191
@nijel nijel Update translations
[CI skip]

Signed-off-by: Michal Čihař <michal@cihar.com>
77bc28a
@nijel nijel Import translations from phpMyAdmin
Signed-off-by: Michal Čihař <michal@cihar.com>
efac573
@nijel
Member
nijel commented Dec 21, 2016

Superseded by #106

@nijel nijel closed this Dec 21, 2016
@nijel nijel deleted the nijel:motranslator branch Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment