Commit 3556ea28 authored by dpapad's avatar dpapad Committed by Commit Bot

PDF Viewer: Use $i18n{} to populate |lang| and |dir| HTML attributes.

Bug: 1091516
Change-Id: I9dd3708416b1ea120f23238050e8ab6c52cdc77b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2244194
Commit-Queue: dpapad <dpapad@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Auto-Submit: dpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#778985}
parent 4764f4e0
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_content_client.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
...@@ -116,6 +117,9 @@ void AddPdfViewerStrings(base::Value* dict) { ...@@ -116,6 +117,9 @@ void AddPdfViewerStrings(base::Value* dict) {
}; };
for (const auto& resource : kPdfResources) for (const auto& resource : kPdfResources)
dict->SetStringKey(resource.name, l10n_util::GetStringUTF16(resource.id)); dict->SetStringKey(resource.name, l10n_util::GetStringUTF16(resource.id));
webui::SetLoadTimeDataDefaults(g_browser_process->GetApplicationLocale(),
static_cast<base::DictionaryValue*>(dict));
} }
} // namespace } // namespace
......
<!doctype html> <!doctype html>
<html> <html dir="$i18n{textdirection}" lang="$i18n{language}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
......
<!doctype html> <!doctype html>
<html> <html dir="$i18n{textdirection}" lang="$i18n{language}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
......
...@@ -697,11 +697,6 @@ export class PDFViewer { ...@@ -697,11 +697,6 @@ export class PDFViewer {
* @private * @private
*/ */
handleStrings_(strings) { handleStrings_(strings) {
const stringsDictionary =
/** @type {{ textdirection: string, language: string }} */ (strings);
document.documentElement.dir = stringsDictionary.textdirection;
document.documentElement.lang = stringsDictionary.language;
loadTimeData.data = strings; loadTimeData.data = strings;
// Predefined zoom factors to be used when zooming in/out. These are in // Predefined zoom factors to be used when zooming in/out. These are in
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment