Hi all
there is new branch called gettext in git repository. The code is really not ready for merging (at least some fixups to po files are needed), but if you want, you can test it right now.
After checkout you need to generate .mo files which gettext loads and you can do it using scripts/generatemo. Afterwards at least these translations which do not have broken po files should work.
Hi
Dne Thu, 11 Mar 2010 20:03:55 +0100 Michal Čihař michal@cihar.com napsal(a):
there is new branch called gettext in git repository. The code is really not ready for merging (at least some fixups to po files are needed), but if you want, you can test it right now.
After checkout you need to generate .mo files which gettext loads and you can do it using scripts/generatemo. Afterwards at least these translations which do not have broken po files should work.
All major glitches should be fixed now. There is still minor outstanding issue that some translations were marked as fuzzy even though they shouldn't be. I'll try to look at this later and once this is solved, I think it is ready to merge.
Meanwhile I added it to translation server so you can play with it there:
https://l10n.cihar.com/projects/phpmyadmin/
I don't want to announce it to translators yet as I would like to resolve above mentioned issue first (but some of them have already found it anyway).
Hi Michal,
okay this sounds good. But one question: How could / should I access language files with javascript?
Am 12.03.2010 11:03, schrieb Michal Čihař:
Hi
Dne Thu, 11 Mar 2010 20:03:55 +0100 Michal Čihař michal@cihar.com napsal(a):
there is new branch called gettext in git repository. The code is really not ready for merging (at least some fixups to po files are needed), but if you want, you can test it right now.
After checkout you need to generate .mo files which gettext loads and you can do it using scripts/generatemo. Afterwards at least these translations which do not have broken po files should work.
All major glitches should be fixed now. There is still minor outstanding issue that some translations were marked as fuzzy even though they shouldn't be. I'll try to look at this later and once this is solved, I think it is ready to merge.
Meanwhile I added it to translation server so you can play with it there:
https://l10n.cihar.com/projects/phpmyadmin/
I don't want to announce it to translators yet as I would like to resolve above mentioned issue first (but some of them have already found it anyway).
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi
Dne Fri, 12 Mar 2010 12:35:50 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
okay this sounds good. But one question: How could / should I access language files with javascript?
I think it will be same as with old system - PHP will generate the messages to use.
Hi Michal,
I've seen the file /libaries/messages.inc.php. Would this the final solution?
If yes, I can use in template engine things like $strXxxXxx, Else if not, I will write a filter function for TWIG-templating, but I think it would be overheaded.
Is it possible for you, to add a switch in your select lang library? If I need strings in Javascript, that I would be able to include such a thing like: <script type="text/javascript" src="select_lang.php?js=selected_lang"></script> This should me return javascript compatible strings as an object like var pmaStringJS = { strAbortedClients : 'Aborted', /* ... and so on */ 'strZip' : 'zipped' } The Problem: UTF8-Strings should be encoded with \uXXXX. Sample: 'Löschen' will become 'L\u00F6schen'.
Regards Michael
Am 12.03.2010 13:16, schrieb Michal Čihař:
Hi
Dne Fri, 12 Mar 2010 12:35:50 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
okay this sounds good. But one question: How could / should I access language files with javascript?
I think it will be same as with old system - PHP will generate the messages to use.
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
JavaScript files will have a proper string encoding if you send an appropriate HTTP header, no need for making language files unreadable.
2010/3/13 Michael Keck sfnet@michaelkeck.de:
Hi Michal,
I've seen the file /libaries/messages.inc.php. Would this the final solution?
If yes, I can use in template engine things like $strXxxXxx, Else if not, I will write a filter function for TWIG-templating, but I think it would be overheaded.
Is it possible for you, to add a switch in your select lang library? If I need strings in Javascript, that I would be able to include such a thing like:
<script type="text/javascript" src="select_lang.php?js=selected_lang"></script>
This should me return javascript compatible strings as an object like var pmaStringJS = { strAbortedClients : 'Aborted', /* ... and so on */ 'strZip' : 'zipped' } The Problem: UTF8-Strings should be encoded with \uXXXX. Sample: 'Löschen' will become 'L\u00F6schen'.
Regards Michael
Am 12.03.2010 13:16, schrieb Michal Čihař:
Hi
Dne Fri, 12 Mar 2010 12:35:50 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
okay this sounds good. But one question: How could / should I access language files with javascript?
I think it will be same as with old system - PHP will generate the messages to use.
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi,
perhabs you may be wrong. Why is this unreadable?
I need this for jQuery and other JS-Libraries. But no body needs to read these Javascript language files, edit or modify. These files should be dynamicly sent to the browser, based on php functions (made by Michal) and the still available language files (branch gettext).
Other point: It does not really help to set proper string encoding appropriate HTTP, if an user has wrong encoding setup in his browser. In such a case, javascript wouldn't work correctly and produces a errors on special chars. With \uXXXX the displayed text may be corrupted - but the javascript still works.
Michael
Am 13.03.2010 17:27, schrieb Piotr Przybylski:
JavaScript files will have a proper string encoding if you send an appropriate HTTP header, no need for making language files unreadable.
2010/3/13 Michael Keck sfnet@michaelkeck.de:
Hi Michal,
I've seen the file /libaries/messages.inc.php. Would this the final solution?
If yes, I can use in template engine things like $strXxxXxx, Else if not, I will write a filter function for TWIG-templating, but I think it would be overheaded.
Is it possible for you, to add a switch in your select lang library? If I need strings in Javascript, that I would be able to include such a thing like:
<script type="text/javascript" src="select_lang.php?js=selected_lang"></script>
This should me return javascript compatible strings as an object like var pmaStringJS = { strAbortedClients : 'Aborted', /* ... and so on */ 'strZip' : 'zipped' } The Problem: UTF8-Strings should be encoded with \uXXXX. Sample: 'Löschen' will become 'L\u00F6schen'.
Regards Michael
Am 12.03.2010 13:16, schrieb Michal Čihař:
Hi
Dne Fri, 12 Mar 2010 12:35:50 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
okay this sounds good. But one question: How could / should I access language files with javascript?
I think it will be same as with old system - PHP will generate the messages to use.
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
I meant "unreadable for translators". If you do the escaping automatic, then I agree, that this is a more bulletproof solution.
2010/3/13 Michael Keck sfnet@michaelkeck.de:
Hi,
perhabs you may be wrong. Why is this unreadable?
I need this for jQuery and other JS-Libraries. But no body needs to read these Javascript language files, edit or modify. These files should be dynamicly sent to the browser, based on php functions (made by Michal) and the still available language files (branch gettext).
Other point: It does not really help to set proper string encoding appropriate HTTP, if an user has wrong encoding setup in his browser. In such a case, javascript wouldn't work correctly and produces a errors on special chars. With \uXXXX the displayed text may be corrupted - but the javascript still works.
Michael
Am 13.03.2010 17:27, schrieb Piotr Przybylski:
JavaScript files will have a proper string encoding if you send an appropriate HTTP header, no need for making language files unreadable.
2010/3/13 Michael Keck sfnet@michaelkeck.de:
Hi Michal,
I've seen the file /libaries/messages.inc.php. Would this the final solution?
If yes, I can use in template engine things like $strXxxXxx, Else if not, I will write a filter function for TWIG-templating, but I think it would be overheaded.
Is it possible for you, to add a switch in your select lang library? If I need strings in Javascript, that I would be able to include such a thing like:
<script type="text/javascript" src="select_lang.php?js=selected_lang"></script>
This should me return javascript compatible strings as an object like var pmaStringJS = { strAbortedClients : 'Aborted', /* ... and so on */ 'strZip' : 'zipped' } The Problem: UTF8-Strings should be encoded with \uXXXX. Sample: 'Löschen' will become 'L\u00F6schen'.
Regards Michael
Am 12.03.2010 13:16, schrieb Michal Čihař:
Hi
Dne Fri, 12 Mar 2010 12:35:50 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
okay this sounds good. But one question: How could / should I access language files with javascript?
I think it will be same as with old system - PHP will generate the messages to use.
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi
Dne Sat, 13 Mar 2010 16:00:13 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
I've seen the file /libaries/messages.inc.php. Would this the final solution?
No, the messages should be used directly in code/templates, this is just for the easy transition, because this way we can use gettext without really changing most of the code. I plan to move messages slowly from messages.inc.php to places where they belong, but it is nothing high priority.
If yes, I can use in template engine things like $strXxxXxx, Else if not, I will write a filter function for TWIG-templating, but I think it would be overheaded.
It looks to me strange that there is not a templating system for PHP which support localization natively.
Is it possible for you, to add a switch in your select lang library? If I need strings in Javascript, that I would be able to include such a thing like:
<script type="text/javascript" src="select_lang.php?js=selected_lang"></script>
This should me return javascript compatible strings as an object like var pmaStringJS = { strAbortedClients : 'Aborted', /* ... and so on */ 'strZip' : 'zipped' }
I really don't see single reason why it should be part of select_lang.php (especially as it is in libaries, which we suggest to protect from remote access). But we can definitely create such code. Django has something what provides gettext like functionality to javascript, but I don't know if the code is enough generic so that it can be used in other project.
The Problem: UTF8-Strings should be encoded with \uXXXX. Sample: 'Löschen' will become 'L\u00F6schen'.
There is some problem in using http headers for defining charset for javascript?
Hi Micha,
Am 14.03.2010 17:47, schrieb Michal Čihař:
Hi
Dne Sat, 13 Mar 2010 16:00:13 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
I've seen the file /libaries/messages.inc.php. Would this the final solution?
No, the messages should be used directly in code/templates, this is just for the easy transition, because this way we can use gettext without really changing most of the code. I plan to move messages slowly from messages.inc.php to places where they belong, but it is nothing high priority.
Okay ... perhabs with templating I must do this if we don't want use the $strNameWhatElseEver in future releases.
If yes, I can use in template engine things like $strXxxXxx, Else if not, I will write a filter function for TWIG-templating, but I think it would be overheaded.
It looks to me strange that there is not a templating system for PHP which support localization natively.
Yes your right. Many template designers uses for each language a languag file (as we done), or - that's a really terrible way - for each langage an own skin (roll eyes). Internationalization is not a proiority by templete engines, but by the way Dwoo (alternative to Smarty, but for PHP 5 and faster) has this functional, and in Twig I must write my own filter. If we want switch later to Symfony framework, we can use Dwoo or Twig as a plugin. For other frameworks (like Zend) only Dwoo has a ready to go plugin feature. Perhabs it would be better to use Dwoo instead of Twig?
Is it possible for you, to add a switch in your select lang library? If I need strings in Javascript, that I would be able to include such a thing like:
<script type="text/javascript" src="select_lang.php?js=selected_lang"></script>
This should me return javascript compatible strings as an object like var pmaStringJS = { strAbortedClients : 'Aborted', /* ... and so on */ 'strZip' : 'zipped' }
I really don't see single reason why it should be part of select_lang.php (especially as it is in libaries, which we suggest to protect from remote access).
Was only a sample. A own script would be good to ;)
But we can definitely create such code. Django has something what provides gettext like functionality to javascript, but I don't know if the code is enough generic so that it can be used in other project.
Django is python or I'm wrong?
The Problem: UTF8-Strings should be encoded with \uXXXX. Sample: 'Löschen' will become 'L\u00F6schen'.
There is some problem in using http headers for defining charset for javascript?
Yes, browser can ignore charset (by wrong encoding settings). This is a bulletproof solution. Many big JS-projects (like TinyMCE or jQuery) use the \uXXXX, cause only displayed text will be damaged, not the functional of a script. At the moment at the latest release all works fine with js, but when I switch to template base and jQuery perhabs I need new translated strings. That's the reason, why I started discussion.
Michael
Hi
Dne Sun, 14 Mar 2010 21:12:05 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
Okay ... perhabs with templating I must do this if we don't want use the $strNameWhatElseEver in future releases.
Anyway there should be (yet another) abstraction layer, so using something like $strFoo in templates can actually make sense. Simply we need to control texts ourself and give theme designers only control around the interface. The more I'm thinking about this the more I think that XSLT transformation might better for this than template system.
We would simply generate XML describing the interface and the XSLT will transform that into HTML sent to user (for example I know that CDash is using this approach).
But we can definitely create such code. Django has something what provides gettext like functionality to javascript, but I don't know if the code is enough generic so that it can be used in other project.
Django is python or I'm wrong?
Yes it's Python :-). I'm just using it as example because I'm currently writing our internal tool in it and I know quite well how it works.
The Problem: UTF8-Strings should be encoded with \uXXXX. Sample: 'Löschen' will become 'L\u00F6schen'.
There is some problem in using http headers for defining charset for javascript?
Yes, browser can ignore charset (by wrong encoding settings).
Well in this case also text in pages will be wrong and we can not do much about that. I would simply ignore this scenario (no that automatically convert generated strings would be problem).
This is a bulletproof solution. Many big JS-projects (like TinyMCE or jQuery) use the \uXXXX, cause only displayed text will be damaged, not the functional of a script.
As our intention is still to make the phpMyAdmin work without javascript it's not that big problem.
Hi Michal,
I've found a solution and it worked for me now: I've contacted the developer of TWIG and he gives me a sample filter for gettext. So I can use in templates as an expample {{ 'Welcome to phpMyAdmin'|t }}.
I know, that phpMyAdmin should still work without javascript. Javascript should only be a feature. But if user want to use javascript, this should be secure enough.
I guess with you, that with wrong encoding/charset in browser settings also text in pages may be displayed wrong, but phpMyAdmin still works. Perhabs I will see 'L?schen' instead of 'Löschen', but it still works. But it's different in javascript (I've written many javascripts in past): With wrong encoding/charset in browser settings, you'll get 'Löschen' (or something other terrible for javascript like 'ä' for the letter 'ä') for the string 'Löschen', which crashes all used javascripts. With my "bulletproof"-suggestion (using 'L\u00F6schen' instead of 'Löschen'), only the text is displayed wrong (I will see 'L\u00F6schen' or 'L?schen' instead 'Löschen'), but javascript still working.
Regards Michael
Hi
Dne Mon, 15 Mar 2010 12:29:48 +0100 Michael Keck sfnet@michaelkeck.de napsal(a):
I've found a solution and it worked for me now: I've contacted the developer of TWIG and he gives me a sample filter for gettext. So I can use in templates as an expample {{ 'Welcome to phpMyAdmin'|t }}.
Well the think I realized is that we don't wont texts in themes which will be contributed. It needs to be separated from it. The texts should be managed by us and themes should contain only design.
I know, that phpMyAdmin should still work without javascript. Javascript should only be a feature. But if user want to use javascript, this should be secure enough.
I guess with you, that with wrong encoding/charset in browser settings also text in pages may be displayed wrong, but phpMyAdmin still works. Perhabs I will see 'L?schen' instead of 'Löschen', but it still works. But it's different in javascript (I've written many javascripts in past): With wrong encoding/charset in browser settings, you'll get 'Löschen' (or something other terrible for javascript like 'ä' for the letter 'ä') for the string 'Löschen', which crashes all used javascripts. With my "bulletproof"-suggestion (using 'L\u00F6schen' instead of 'Löschen'), only the text is displayed wrong (I will see 'L\u00F6schen' or 'L?schen' instead 'Löschen'), but javascript still working.
You will get broken strings in both cases so I really don't see big advantage ;-).