Bug 168465 - Web Inspector: Loc: Zoom level in Settings tab needs to use localized formatting
Summary: Web Inspector: Loc: Zoom level in Settings tab needs to use localized formatting
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: BJ Burg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-16 14:16 PST by BJ Burg
Modified: 2017-02-17 14:41 PST (History)
4 users (show)

See Also:


Attachments
[AFTER] tr-TR locale (125.46 KB, image/png)
2017-02-16 14:17 PST, BJ Burg
no flags Details
Patch (2.00 KB, patch)
2017-02-16 14:22 PST, BJ Burg
no flags Details | Formatted Diff | Diff
Patch v2 (1.75 KB, patch)
2017-02-16 15:10 PST, BJ Burg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description BJ Burg 2017-02-16 14:16:35 PST
Intl to the rescue!
Comment 1 BJ Burg 2017-02-16 14:17:32 PST
STEPS TO REPRODUCE:
- Open Settings Tab
- Look at Zoom Level: section

EXPECTED:

With en-US locale, should be 100%, 120%, etc.
With tr-TR locale, should be %100, %120, etc.
Comment 2 BJ Burg 2017-02-16 14:17:51 PST
Created attachment 301823 [details]
[AFTER] tr-TR locale
Comment 3 BJ Burg 2017-02-16 14:22:47 PST
Created attachment 301824 [details]
Patch
Comment 4 Joseph Pecoraro 2017-02-16 14:30:06 PST
Comment on attachment 301824 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=301824&action=review

> Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:188
> -                option.textContent = `${Math.round(level * 100)}%`;
> +                option.textContent = formatter.format(level);

We have Number.percentageString in Utilities.js. Should we just use that?
Comment 5 BJ Burg 2017-02-16 15:08:28 PST
(In reply to comment #4)
> Comment on attachment 301824 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=301824&action=review
> 
> > Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:188
> > -                option.textContent = `${Math.round(level * 100)}%`;
> > +                option.textContent = formatter.format(level);
> 
> We have Number.percentageString in Utilities.js. Should we just use that?

Had no idea. Yes, it works the same it seems.
Comment 6 BJ Burg 2017-02-16 15:10:43 PST
Created attachment 301836 [details]
Patch v2
Comment 7 Matt Baker 2017-02-17 09:55:02 PST
Comment on attachment 301836 [details]
Patch v2

Text isn't being localized with the patch applied
Comment 8 BJ Burg 2017-02-17 14:00:57 PST
(In reply to comment #1)
> STEPS TO REPRODUCE:
> - Open Settings Tab
> - Look at Zoom Level: section
> 
> EXPECTED:
> 
> With en-US locale, should be 100%, 120%, etc.
> With tr-TR locale, should be %100, %120, etc.

To get tr-TR locale on macOS, go to System Preferences > Language & Region and add Turkish/Türkçe, then drag it to the top position. Relaunch Safari.
Comment 9 BJ Burg 2017-02-17 14:01:13 PST
(In reply to comment #7)
> Comment on attachment 301836 [details]
> Patch v2
> 
> Text isn't being localized with the patch applied

It works for me. Did you change the system language?
Comment 10 Matt Baker 2017-02-17 14:15:47 PST
(In reply to comment #9)
> (In reply to comment #7)
> > Comment on attachment 301836 [details]
> > Patch v2
> > 
> > Text isn't being localized with the patch applied
> 
> It works for me. Did you change the system language?

Works! My mistake.
Comment 11 WebKit Commit Bot 2017-02-17 14:41:27 PST
Comment on attachment 301836 [details]
Patch v2

Clearing flags on attachment: 301836

Committed r212578: <http://trac.webkit.org/changeset/212578>
Comment 12 WebKit Commit Bot 2017-02-17 14:41:32 PST
All reviewed patches have been landed.  Closing bug.