Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing query time in German #13975

Closed
benjaminfunk opened this issue Feb 7, 2018 · 16 comments
Closed

Missing query time in German #13975

benjaminfunk opened this issue Feb 7, 2018 · 16 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Milestone

Comments

@benjaminfunk
Copy link

benjaminfunk commented Feb 7, 2018

The query execution time in above the query box is alway 0.0000 seconds when i activate the german language.

Version 4.7+

@nijel
Copy link
Contributor

nijel commented Mar 1, 2018

I can't reproduce this:

screenshot-2018-3-1 localhost localhost iframe onload ale2 fdsafsa phpmyadmin 4 7 9-dev

What version do you use?

@nijel nijel self-assigned this Mar 1, 2018
@nijel nijel added the question Used when we need feedback from the submitter or when the issue is a question about PMA label Mar 1, 2018
@benjaminfunk
Copy link
Author

Version 4.7.9 for WampServer (local environment)

Maybe its a WampServer related bug if u cant reproduce it

@nijel
Copy link
Contributor

nijel commented Mar 7, 2018

Does it happen for every query or only in some specific cases?

@benjaminfunk
Copy link
Author

Looks like every query

@williamdes
Copy link
Member

williamdes commented Jun 10, 2018

@benjaminfunk Can you try on version 4.8.1 ?

Can you send more informations on OS, web server if 4.8.1 has the issue ?

I think that I had the same issue with French on a Windows 10 running IIS and MySQL ~5.7.

@benjaminfunk
Copy link
Author

@williamdes The problem still exists with phpMyAdmin 4.8.1 in my environment

Windows 10
Apache 2.4.33
PHP 7.2.6
MySQL 5.7.22

@williamdes
Copy link
Member

williamdes commented Jul 3, 2018

Successfully reproduced on Windows 10 ( 10.0.10586 ) and VirtualBox with :

  • Apache 2.4.33
  • PHP 7.2.7
  • MySQL 8.0.11
  • PhpMyAdmin 4.8.2
  • Language: French, German

Investigating...

@williamdes
Copy link
Member

williamdes commented Jul 3, 2018

  • = Does not work
  • = Works (Has SQL time)

Results

  • العربية - Arabic
  • Հայերէն - Armenian
  • Azərbaycanca - Azerbaijani
  • বাংলা - Bangla
  • Беларуская - Belarusian
  • Български - Bulgarian
  • Català - Catalan
  • 中文 - Chinese simplified
  • 中文 - Chinese traditional
  • Čeština - Czech
  • Dansk - Danish
  • Nederlands - Dutch
  • English
  • English (United Kingdom)
  • Eesti - Estonian
  • Suomi - Finnish
  • Français - French
  • Galego - Galician
  • Deutsch - German
  • Ελληνικά - Greek
  • Magyar - Hungarian
  • Bahasa Indonesia - Indonesian
  • Interlingua
  • Italiano - Italian
  • 日本語 - Japanese
  • 한국어 - Korean
  • Lietuvių - Lithuanian
  • Norsk - Norwegian
  • Polski - Polish
  • Português - Portuguese
  • Português (Brasil) - Portuguese (Brazil)
  • Română - Romanian
  • Русский - Russian
  • Srpski - Serbian (latin)
  • සිංහල - Sinhala
  • Shqip - Slbanian
  • Slovenčina - Slovak
  • Slovenščina - Slovenian
  • Español - Spanish
  • Svenska - Swedish
  • Türkçe - Turkish
  • Українська - Ukrainian
  • Tiếng Việt - Vietnamese

@williamdes
Copy link
Member

  • When copying french .mo file in pt_BR folder It works (conclusion mo file is not where this issue is)
  • Copy the fr folder to fr_FR and It works !
  • Or rename es folder to ES_ES or es@es

I found where is the error, remove this line (some codes work perfectly) :

setlocale(0, $this->code);

https://stackoverflow.com/a/29522488/5155484

https://stackoverflow.com/questions/32339621/php-setlocale-not-working-correctly-on-windows-10-machine

@MauricioFauth do you think we can skip this line for windows platform or remove it completely ?

@MauricioFauth
Copy link
Member

Can you help with that, @nijel?

@williamdes
Copy link
Member

@nijel Can you please have a look when you have some time ?

@nijel
Copy link
Contributor

nijel commented Sep 25, 2018

AFAIK without this the numbers and dates won't be localized at all (that should be easy to verify).

Anyway this really boils down to broken sprintf after calling setlocale? Can you try following snippet?

<?php
$value = 0.001;
echo sprintf("original = %01.4f\n");
setlocale(0, 'de');
echo sprintf("localized = %01.4f\n");

What's result of setlocale in this case? Maybe handling failure and using some other locale instead could be a workaround (apparently some of them seem to work).

@benjaminfunk
Copy link
Author

AFAIK without this the numbers and dates won't be localized at all (that should be easy to verify).

Anyway this really boils down to broken sprintf after calling setlocale? Can you try following snippet?

<?php
$value = 0.001;
echo sprintf("original = %01.4f\n");
setlocale(0, 'de');
echo sprintf("localized = %01.4f\n");

What's result of setlocale in this case? Maybe handling failure and using some other locale instead could be a workaround (apparently some of them seem to work).

I had a similar issue with floating numbers. Try to uppercase the "f" in the sprintf function.

Look here: http://php.net/manual/de/function.sprintf.php#49254

@nijel
Copy link
Contributor

nijel commented Sep 27, 2018

But that will ruin the localization for everybody, not just for the broken systems...

@williamdes williamdes added the Bug A problem or regression with an existing feature label Oct 27, 2018
ppastercik added a commit to ppastercik/phpmyadmin that referenced this issue Jan 3, 2019
…er format issue)

Signed-off-by: Patrik Pasterčík <plaki@seznam.cz>
@ppastercik
Copy link
Contributor

I find solution to fix this problem.
I want to pull request, but I don't know which branch I can pull request. Do I pull request to master branch?

Problem is conversion of number from int/float to string (when adding parameter to Message class) and then using sprintf funciton to format string. Some locales use comma as decimal separator and it is problem, when we want use this number (as string) in sprintf function. PHP can't convert number from string to float when decimal separator is comma (with dot working fine), so it converts it to integer number, because comma is invalid character to convert to number. I think that if we want format number by sprintf function, number parameter must have right number format (numeric variable or string with dot decimal separator), if it's string, it's convert string to number and then format it. I hope that I describe it understandably.

@nijel I think I know why you couldn't reproduce it. It's because some servers (computers) not have installed support for different locales, so it's not use comma as decimal separator but use dot as decimal separator as fallback. With dot separator everything is working fine.

@ibennetch
Copy link
Member

@Plaki I won't comment on the solution you've found (it makes sense, though), but a fix should preferably target the QA_4_8 branch.

@williamdes williamdes added has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete and removed question Used when we need feedback from the submitter or when the issue is a question about PMA labels Jan 4, 2019
williamdes added a commit that referenced this issue Mar 2, 2019
Fixes: #13975
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Mar 2, 2019
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes added this to the 4.8.6 milestone Mar 2, 2019
@williamdes williamdes self-assigned this Mar 2, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
None yet
Development

No branches or pull requests

6 participants