Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc

Issue 2627023006: WebUI: Remove i18n from cr_elements/network (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provide r.h" 5 #include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provide r.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/number_formatting.h" 10 #include "base/i18n/number_formatting.h"
(...skipping 18 matching lines...) Expand all
29 #include "components/password_manager/core/browser/password_manager_constants.h" 29 #include "components/password_manager/core/browser/password_manager_constants.h"
30 #include "components/safe_browsing_db/safe_browsing_prefs.h" 30 #include "components/safe_browsing_db/safe_browsing_prefs.h"
31 #include "components/strings/grit/components_strings.h" 31 #include "components/strings/grit/components_strings.h"
32 #include "content/public/browser/web_ui_data_source.h" 32 #include "content/public/browser/web_ui_data_source.h"
33 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
34 34
35 35
36 #if defined(OS_CHROMEOS) 36 #if defined(OS_CHROMEOS)
37 #include "ash/common/system/chromeos/devicetype_utils.h" 37 #include "ash/common/system/chromeos/devicetype_utils.h"
38 #include "chrome/browser/chromeos/profiles/profile_helper.h" 38 #include "chrome/browser/chromeos/profiles/profile_helper.h"
39 #include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_pro vider.h"
39 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" 40 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h"
40 #include "chromeos/chromeos_switches.h" 41 #include "chromeos/chromeos_switches.h"
41 #include "components/user_manager/user.h" 42 #include "components/user_manager/user.h"
42 #include "components/user_manager/user_manager.h" 43 #include "components/user_manager/user_manager.h"
43 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" 44 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h"
44 #else 45 #else
45 #include "chrome/browser/ui/webui/settings/system_handler.h" 46 #include "chrome/browser/ui/webui/settings/system_handler.h"
46 #endif 47 #endif
47 48
48 namespace settings { 49 namespace settings {
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 {"loading", IDS_SETTINGS_LOADING}, 1734 {"loading", IDS_SETTINGS_LOADING},
1734 {"advancedFontSettings", IDS_SETTINGS_ADVANCED_FONT_SETTINGS}, 1735 {"advancedFontSettings", IDS_SETTINGS_ADVANCED_FONT_SETTINGS},
1735 {"openAdvancedFontSettings", IDS_SETTINGS_OPEN_ADVANCED_FONT_SETTINGS}, 1736 {"openAdvancedFontSettings", IDS_SETTINGS_OPEN_ADVANCED_FONT_SETTINGS},
1736 {"requiresWebStoreExtension", IDS_SETTINGS_REQUIRES_WEB_STORE_EXTENSION}, 1737 {"requiresWebStoreExtension", IDS_SETTINGS_REQUIRES_WEB_STORE_EXTENSION},
1737 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, 1738 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX},
1738 }; 1739 };
1739 AddLocalizedStringsBulk(html_source, localized_strings, 1740 AddLocalizedStringsBulk(html_source, localized_strings,
1740 arraysize(localized_strings)); 1741 arraysize(localized_strings));
1741 } 1742 }
1742 1743
1743 } // namespace
1744
1745 #if defined(OS_CHROMEOS) 1744 #if defined(OS_CHROMEOS)
1746 void AddCrNetworkStrings(content::WebUIDataSource* html_source) { 1745 void AddOncStrings(content::WebUIDataSource* html_source) {
1747 LocalizedString localized_strings[] = {
1748 {"networkDisabled", IDS_NETWORK_LIST_DISABLED},
1749 {"networkListItemConnected", IDS_NETWORK_LIST_CONNECTED},
1750 {"networkListItemConnecting", IDS_NETWORK_LIST_CONNECTING},
1751 {"networkListItemNotConnected", IDS_NETWORK_LIST_NOT_CONNECTED},
1752 {"vpnNameTemplate", IDS_NETWORK_LIST_THIRD_PARTY_VPN_NAME_TEMPLATE},
1753 };
1754 AddLocalizedStringsBulk(html_source, localized_strings,
1755 arraysize(localized_strings));
1756 LocalizedString onc_property_strings[] = { 1746 LocalizedString onc_property_strings[] = {
1757 // Thes strings are generated by prepending 'Onc' to the ONC property 1747 // Thes strings are generated by prepending 'Onc' to the ONC property
1758 // name. Any '.' in the property name is replaced with '-'. Properties 1748 // name. Any '.' in the property name is replaced with '-'. Properties
1759 // with translatable enumerated values have the value appended after '_'. 1749 // with translatable enumerated values have the value appended after '_'.
1760 {"OncCellular-APN-AccessPointName", 1750 {"OncCellular-APN-AccessPointName",
1761 IDS_ONC_CELLULAR_APN_ACCESS_POINT_NAME}, 1751 IDS_ONC_CELLULAR_APN_ACCESS_POINT_NAME},
1762 {"OncCellular-APN-AccessPointName_none", 1752 {"OncCellular-APN-AccessPointName_none",
1763 IDS_ONC_CELLULAR_APN_ACCESS_POINT_NAME_NONE}, 1753 IDS_ONC_CELLULAR_APN_ACCESS_POINT_NAME_NONE},
1764 {"OncCellular-APN-Password", IDS_ONC_CELLULAR_APN_PASSWORD}, 1754 {"OncCellular-APN-Password", IDS_ONC_CELLULAR_APN_PASSWORD},
1765 {"OncCellular-APN-Username", IDS_ONC_CELLULAR_APN_USERNAME}, 1755 {"OncCellular-APN-Username", IDS_ONC_CELLULAR_APN_USERNAME},
(...skipping 24 matching lines...) Expand all
1790 IDS_ONC_CELLULAR_ROAMING_STATE_ROAMING}, 1780 IDS_ONC_CELLULAR_ROAMING_STATE_ROAMING},
1791 {"OncCellular-ServingOperator-Code", 1781 {"OncCellular-ServingOperator-Code",
1792 IDS_ONC_CELLULAR_SERVING_OPERATOR_CODE}, 1782 IDS_ONC_CELLULAR_SERVING_OPERATOR_CODE},
1793 {"OncCellular-ServingOperator-Name", 1783 {"OncCellular-ServingOperator-Name",
1794 IDS_ONC_CELLULAR_SERVING_OPERATOR_NAME}, 1784 IDS_ONC_CELLULAR_SERVING_OPERATOR_NAME},
1795 {"OncConnected", IDS_ONC_CONNECTED}, 1785 {"OncConnected", IDS_ONC_CONNECTED},
1796 {"OncConnecting", IDS_ONC_CONNECTING}, 1786 {"OncConnecting", IDS_ONC_CONNECTING},
1797 {"OncMacAddress", IDS_ONC_MAC_ADDRESS}, 1787 {"OncMacAddress", IDS_ONC_MAC_ADDRESS},
1798 {"OncNotConnected", IDS_ONC_NOT_CONNECTED}, 1788 {"OncNotConnected", IDS_ONC_NOT_CONNECTED},
1799 {"OncRestrictedConnectivity", IDS_ONC_RESTRICTED_CONNECTIVITY}, 1789 {"OncRestrictedConnectivity", IDS_ONC_RESTRICTED_CONNECTIVITY},
1800 {"OncTypeCellular", IDS_SETTINGS_NETWORK_TYPE_CELLULAR},
1801 {"OncTypeEthernet", IDS_SETTINGS_NETWORK_TYPE_ETHERNET},
1802 {"OncTypeVPN", IDS_SETTINGS_NETWORK_TYPE_VPN},
1803 {"OncTypeWiFi", IDS_SETTINGS_NETWORK_TYPE_WIFI},
1804 {"OncTypeWiMAX", IDS_SETTINGS_NETWORK_TYPE_WIMAX},
1805 {"OncVPN-Host", IDS_ONC_VPN_HOST}, 1790 {"OncVPN-Host", IDS_ONC_VPN_HOST},
1806 {"OncVPN-L2TP-Username", IDS_ONC_VPN_L2TP_USERNAME}, 1791 {"OncVPN-L2TP-Username", IDS_ONC_VPN_L2TP_USERNAME},
1807 {"OncVPN-OpenVPN-Username", IDS_ONC_VPN_OPEN_VPN_USERNAME}, 1792 {"OncVPN-OpenVPN-Username", IDS_ONC_VPN_OPEN_VPN_USERNAME},
1808 {"OncVPN-ThirdPartyVPN-ProviderName", 1793 {"OncVPN-ThirdPartyVPN-ProviderName",
1809 IDS_ONC_VPN_THIRD_PARTY_VPN_PROVIDER_NAME}, 1794 IDS_ONC_VPN_THIRD_PARTY_VPN_PROVIDER_NAME},
1810 {"OncVPN-Type", IDS_ONC_VPN_TYPE}, 1795 {"OncVPN-Type", IDS_ONC_VPN_TYPE},
1811 {"OncWiFi-Frequency", IDS_ONC_WIFI_FREQUENCY}, 1796 {"OncWiFi-Frequency", IDS_ONC_WIFI_FREQUENCY},
1812 {"OncWiFi-Security", IDS_ONC_WIFI_SECURITY}, 1797 {"OncWiFi-Security", IDS_ONC_WIFI_SECURITY},
1813 {"OncWiFi-SignalStrength", IDS_ONC_WIFI_SIGNAL_STRENGTH}, 1798 {"OncWiFi-SignalStrength", IDS_ONC_WIFI_SIGNAL_STRENGTH},
1814 {"OncWiMAX-EAP-Identity", IDS_ONC_WIMAX_EAP_IDENTITY}, 1799 {"OncWiMAX-EAP-Identity", IDS_ONC_WIMAX_EAP_IDENTITY},
1815 {"Oncipv4-Gateway", IDS_ONC_IPV4_GATEWAY}, 1800 {"Oncipv4-Gateway", IDS_ONC_IPV4_GATEWAY},
1816 {"Oncipv4-IPAddress", IDS_ONC_IPV4_ADDRESS}, 1801 {"Oncipv4-IPAddress", IDS_ONC_IPV4_ADDRESS},
1817 {"Oncipv4-RoutingPrefix", IDS_ONC_IPV4_ROUTING_PREFIX}, 1802 {"Oncipv4-RoutingPrefix", IDS_ONC_IPV4_ROUTING_PREFIX},
1818 {"Oncipv6-IPAddress", IDS_ONC_IPV6_ADDRESS}, 1803 {"Oncipv6-IPAddress", IDS_ONC_IPV6_ADDRESS},
1819 }; 1804 };
1820 AddLocalizedStringsBulk(html_source, onc_property_strings, 1805 AddLocalizedStringsBulk(html_source, onc_property_strings,
1821 arraysize(onc_property_strings)); 1806 arraysize(onc_property_strings));
1822 } 1807 }
1823 #endif // OS_CHROMEOS 1808 #endif // OS_CHROMEOS
1824 1809
1810 } // namespace
1811
1825 void AddLocalizedStrings(content::WebUIDataSource* html_source, 1812 void AddLocalizedStrings(content::WebUIDataSource* html_source,
1826 Profile* profile) { 1813 Profile* profile) {
1827 AddA11yStrings(html_source); 1814 AddA11yStrings(html_source);
1828 AddAboutStrings(html_source); 1815 AddAboutStrings(html_source);
1829 AddAppearanceStrings(html_source, profile); 1816 AddAppearanceStrings(html_source, profile);
1830 AddClearBrowsingDataStrings(html_source); 1817 AddClearBrowsingDataStrings(html_source);
1831 AddCommonStrings(html_source, profile); 1818 AddCommonStrings(html_source, profile);
1832 AddDownloadsStrings(html_source); 1819 AddDownloadsStrings(html_source);
1833 AddLanguagesStrings(html_source); 1820 AddLanguagesStrings(html_source);
1834 AddOnStartupStrings(html_source); 1821 AddOnStartupStrings(html_source);
1835 AddPasswordsAndFormsStrings(html_source); 1822 AddPasswordsAndFormsStrings(html_source);
1836 AddPeopleStrings(html_source); 1823 AddPeopleStrings(html_source);
1837 AddPrintingStrings(html_source); 1824 AddPrintingStrings(html_source);
1838 AddPrivacyStrings(html_source, profile); 1825 AddPrivacyStrings(html_source, profile);
1839 AddResetStrings(html_source); 1826 AddResetStrings(html_source);
1840 AddSearchEnginesStrings(html_source); 1827 AddSearchEnginesStrings(html_source);
1841 AddSearchInSettingsStrings(html_source); 1828 AddSearchInSettingsStrings(html_source);
1842 AddSearchStrings(html_source); 1829 AddSearchStrings(html_source);
1843 AddSiteSettingsStrings(html_source, profile); 1830 AddSiteSettingsStrings(html_source, profile);
1844 AddUsersStrings(html_source); 1831 AddUsersStrings(html_source);
1845 AddWebContentStrings(html_source); 1832 AddWebContentStrings(html_source);
1846 1833
1847 #if defined(OS_CHROMEOS) 1834 #if defined(OS_CHROMEOS)
1848 AddAccountUITweaksStrings(html_source, profile); 1835 AddAccountUITweaksStrings(html_source, profile);
1849 AddAndroidAppStrings(html_source); 1836 AddAndroidAppStrings(html_source);
1850 AddBluetoothStrings(html_source); 1837 AddBluetoothStrings(html_source);
1851 AddCrNetworkStrings(html_source);
1852 AddDateTimeStrings(html_source); 1838 AddDateTimeStrings(html_source);
1853 AddDeviceStrings(html_source); 1839 AddDeviceStrings(html_source);
1854 AddEasyUnlockStrings(html_source); 1840 AddEasyUnlockStrings(html_source);
1855 AddInternetStrings(html_source); 1841 AddInternetStrings(html_source);
1856 AddMultiProfilesStrings(html_source, profile); 1842 AddMultiProfilesStrings(html_source, profile);
1843 AddOncStrings(html_source);
1857 #else 1844 #else
1858 AddDefaultBrowserStrings(html_source); 1845 AddDefaultBrowserStrings(html_source);
1859 AddImportDataStrings(html_source); 1846 AddImportDataStrings(html_source);
1860 AddSystemStrings(html_source); 1847 AddSystemStrings(html_source);
1861 #endif 1848 #endif
1862 1849
1863 #if defined(USE_NSS_CERTS) 1850 #if defined(USE_NSS_CERTS)
1864 AddCertificateManagerStrings(html_source); 1851 AddCertificateManagerStrings(html_source);
1865 #endif 1852 #endif
1866 1853
1854 #if defined(OS_CHROMEOS)
1855 chromeos::network_element::AddLocalizedStrings(html_source);
1856 #endif
1867 policy_indicator::AddLocalizedStrings(html_source); 1857 policy_indicator::AddLocalizedStrings(html_source);
1868 1858
1869 html_source->SetJsonPath(kLocalizedStringsFile); 1859 html_source->SetJsonPath(kLocalizedStringsFile);
1870 } 1860 }
1871 1861
1872 } // namespace settings 1862 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698