Bug 55483 - WebKit2 needs to be made localizable
Summary: WebKit2 needs to be made localizable
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-01 10:48 PST by Sam Weinig
Modified: 2011-03-01 11:59 PST (History)
3 users (show)

See Also:


Attachments
Patch (81.13 KB, patch)
2011-03-01 11:17 PST, Sam Weinig
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2011-03-01 10:48:58 PST
WebKit2 needs to be made localizable
Comment 1 Sam Weinig 2011-03-01 11:17:36 PST
Created attachment 84256 [details]
Patch
Comment 2 Anders Carlsson 2011-03-01 11:22:39 PST
Comment on attachment 84256 [details]
Patch

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

> Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm:70
> +    RetainPtr<CFStringRef> cfLocalization(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(localization.characters()), localization.length()));

Can't you just use String::createCFString here?
Comment 3 Timothy Hatcher 2011-03-01 11:26:04 PST
Comment on attachment 84256 [details]
Patch

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

> Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:767
> +    return formatLocalizedString(UI_STRING("<filename> %dÃ%d pixels", "window title suffix for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height()).replace("<filename>", filename);
>  }

Why "<filename>" and not %s or %@?
Comment 4 Sam Weinig 2011-03-01 11:27:10 PST
(In reply to comment #2)
> (From update of attachment 84256 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=84256&action=review
> 
> > Source/WebKit2/PluginProcess/mac/PluginProcessMainMac.mm:70
> > +    RetainPtr<CFStringRef> cfLocalization(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(localization.characters()), localization.length()));
> 
> Can't you just use String::createCFString here?

No. That function only works on the main thread, and at this point, we have not even established a main thread.
Comment 5 Sam Weinig 2011-03-01 11:29:09 PST
(In reply to comment #3)
> (From update of attachment 84256 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=84256&action=review
> 
> > Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:767
> > +    return formatLocalizedString(UI_STRING("<filename> %dÃ%d pixels", "window title suffix for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height()).replace("<filename>", filename);
> >  }
> 
> Why "<filename>" and not %s or %@?

Since this is in cross platform code we cannot use %@ and since the formatter won't necessarily interpret the incoming string as utf8 we can't use %s.
Comment 6 Darin Adler 2011-03-01 11:38:29 PST
(In reply to comment #5)
> the formatter won't necessarily interpret the incoming string as utf8

To be clear: The CFString formatter will *never* interpret the string as UTF-8.
Comment 7 Timothy Hatcher 2011-03-01 11:39:54 PST
There is a downside to "<filename> %dx%d". Localizers can't flip the order like they could with "%@ %dx%d".

They use to be able to do "%2$dx%3$d %1$@".

Though I'm not sure it is the end of the world or if any localizations need it.
Comment 8 Sam Weinig 2011-03-01 11:41:46 PST
Landed in r80014.
Comment 9 Darin Adler 2011-03-01 11:42:54 PST
(In reply to comment #7)
> There is a downside to "<filename> %dx%d". Localizers can't flip the order like they could with "%@ %dx%d".

They can flip the order. And it’s easier than it is with the format string: "%dx%d <filename>".
Comment 10 Timothy Hatcher 2011-03-01 11:49:22 PST
(In reply to comment #9)
> (In reply to comment #7)
> > There is a downside to "<filename> %dx%d". Localizers can't flip the order like they could with "%@ %dx%d".
> 
> They can flip the order. And it’s easier than it is with the format string: "%dx%d <filename>".

Duh! :)
Comment 11 Adam Roben (:aroben) 2011-03-01 11:59:34 PST
Seems like you need to fix update-webkit-localizable-strings, too.