Opened 13 months ago

Last modified 10 months ago

#3697 reviewing change

Fall back to i18n.getUILanguage if @ui_locale isn't supported

Reported by: sebastian Assignee:
Priority: P2 Milestone:
Module: Platform Keywords:
Cc: scottlow Blocked By:
Blocking: Platform: Edge
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29338190/

Description

Background

chrome.i18n.getMessage("@ui_locale") returns the language of the browser's user interface.
chrome.i18n.getMessage("@bidi_dir") returns the respective reading direction of that language.

Adblock Plus relies on these, to show parts of the user interface dependent on the language, as well to account for right-to-left languages, such as Arabic.

Edge, however, won't support these special message IDs from the beginning. But it will support browser.i18n.getUILanguage, which we can fall back to. But note that since this API is new in Chrome 35, we still have to keep using chrome.i18n.getMessage("@ui_locale") on older Chrome versions.

What to change

  • If i18n.getMessage("@ui_locale") returns "" (empty string) fall back to i18n.getUILanguage.
  • If i18n.getMessage("@bidi_dir") returns "" (empty string) fall back to the same logic we use on Safari to determine the reading direction of the UI locale.

Change History (5)

comment:1 Changed 13 months ago by sebastian

  • Summary changed from Fall back to i18n.getUILanguage if @ui_locale isn't supported. to Fall back to i18n.getUILanguage if @ui_locale isn't supported

comment:2 Changed 13 months ago by oleksandr

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed 11 months ago by sebastian

  • Cc scottlow added

comment:4 Changed 10 months ago by sebastian

  • Keywords edge removed
  • Platform changed from Unknown / Cross platform to Edge

comment:5 Changed 10 months ago by sebastian

  • Sensitive unset
Note: See TracTickets for help on using tickets.