Web Share picker: Internationalize the format string |
|||
Issue descriptionChrome Version: 61 OS: Windows, Chrome OS, Linux Currently TargetPickerTableModel::GetText in webshare_target_picker_view.cc hard-codes the format string "%s (%s)" when displaying the name and URL of a target. This string should be internationalized so it can be translated for different locales.
,
Nov 12 2017
I'm new to Chromium community but I'm interested in this feature. My initial idea would be to add an entry in generated_sources.grd file by immitating one of the entries in that file. However, I don't understand exactly how TargetPickerTableModel::GetText is used other than in the unit tests in webshare_target_picker_view_unittest.cc#135 (https://goo.gl/5yTuRb). Also, I have created a small example which shares two contents with the same title but I could not see text with format "title (url)" to differentiate the two: https://goo.gl/EPFqDq I may be overlooking a few things given the fact that I am understanding the Web Share feature. Regardless, I will be happy to get some pointers. Thank you.
,
Nov 13 2017
Thanks for the help! Yes, you need to add a new entry to generated_sources.grd. This one is a good example[1]. TargetPickerTableModel implements the TableModel interface. You can read more about TableModel and TableView here[2]. Regarding not seeing the difference. You might be getting WebShare and WebShareTarget confused. WebShare is for websites to dispatch a Share Intent e.g. the Share button on Twitter. WebShareTarget is for websites to register themselves to handle share intents. This GetText() function is for the latter. I believe it's only implemented on Desktop at the moment. To see the result, you will need to install two apps that support WebShareTarget[3]. [1] https://cs.chromium.org/chromium/src/chrome/app/generated_resources.grd?l=232 [2] https://cs.chromium.org/chromium/src/ui/base/models/table_model.h?type=cs&l=23 [3] https://github.com/WICG/web-share-target/blob/master/docs/explainer.md#sample-code
,
Nov 14 2017
I would like to propose the following entry to generated_sources.grd. With this format, the titles on the list of targets with be in the format "Share target <title> (<url>)". Kindly let me know if there are any suggestions to this format before I work on the source codes. <message name="IDS_WEBSHARE_TARGET_SITE_TITLE" desc="Share target title to disambiguate titles that are the same, and as a security measure. $1 is the title of the target and $2 is its url."> Share target <ph name="APP_NAME">$1<ex>Google</ex>(</ph> <ph name="SITE_NAME">$1<ex>https://google.com</ex></ph>) </message> Thank you.
,
Nov 14 2017
By the way, the links were very useful.
,
Nov 15 2017
The "Share Target" portion seems a bit redundant. "<title> (<url>)" should be enough <message name="IDS_WEBSHARE_TARGET_DIALOG_ITEM_TEXT" desc="Text for a WebShare Target item in the WebShare Target dialog. The text includes the App's name and its URL."> <ph name="APP_NAME">$1<ex>Google Maps</ex> (</ph> <ph name="APP_URL">$2<ex>https://google.com/maps</ex></ph>) </message>
,
Nov 15 2017
Thanks hassansalehe@ for taking this up. If you get it working, please upload a CL and you can add me (mgiuca@) as a reviewer. (It's best to discuss the details of the patch on the code review rather than in the comments on the issue tracker. Don't worry about the CL being perfect before uploading and mailing out.)
,
Nov 16 2017
I have uploaded CL here: https://chromium-review.googlesource.com/c/chromium/src/+/774279
,
Nov 21 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/899982775f890b216290d5818292fde0ac04868f commit 899982775f890b216290d5818292fde0ac04868f Author: Hassan Salehe Matar <hassansalehe@gmail.com> Date: Tue Nov 21 03:25:15 2017 Internationalize text for a WebShare Target item This replaces hard-coded string with internationalization format for displaying name and URL of each item in the WebShare Target dialog. R=mgiuca@chromium.org, sky@chromium.org Bug: 733916 Change-Id: I9032cf3770e1f2dccbdc22a452db6d8f95ef46a1 Reviewed-on: https://chromium-review.googlesource.com/774279 Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Matt Giuca <mgiuca@chromium.org> Commit-Queue: Matt Giuca <mgiuca@chromium.org> Cr-Commit-Position: refs/heads/master@{#518076} [modify] https://crrev.com/899982775f890b216290d5818292fde0ac04868f/AUTHORS [modify] https://crrev.com/899982775f890b216290d5818292fde0ac04868f/chrome/app/generated_resources.grd [modify] https://crrev.com/899982775f890b216290d5818292fde0ac04868f/chrome/browser/ui/views/webshare/webshare_target_picker_view.cc
,
Nov 21 2017
Landed. Thanks very much for your help! |
|||
►
Sign in to add a comment |
|||
Comment 1 by mgiuca@chromium.org
, Jun 16 2017