CINXE.COM
ICU — Firefox Source Docs documentation
<!doctype html> <html class="writer-html5" lang="en" data-content_root="../"> <head> <base href="https://firefox-source-docs.mozilla.org/intl/icu.html"> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>ICU — Firefox Source Docs documentation</title> <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50"> <link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=19f00094"> <link rel="stylesheet" type="text/css" href="../_static/graphviz.css?v=fd3f3429"> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b"> <link rel="stylesheet" type="text/css" href="../_static/custom_theme.css?v=a7d3e023"> <link rel="stylesheet" type="text/css" href="../_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7"> <link rel="shortcut icon" href="../_static/firefox.ico"><!--[if lt IE 9]> <script src="../_static/js/html5shiv.min.js"></script> <![endif]--> <script src="../_static/jquery.js?v=5d32c60e"></script> <script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> <script src="../_static/documentation_options.js?v=5929fcd5"></script> <script src="../_static/doctools.js?v=9a2dae69"></script> <script src="../_static/sphinx_highlight.js?v=dc90522c"></script> <script src="../_static/clipboard.min.js?v=a7894cd8"></script> <script src="../_static/copybutton.js?v=30646c52"></script> <script src="../_static/design-tabs.js?v=36754332"></script> <script src="../_static/js/theme.js"></script> <link rel="index" title="Index" href="../genindex.html"> <link rel="search" title="Search" href="../search.html"> <link rel="next" title="ICU4X" href="icu4x.html"> <link rel="prev" title="UI Internationalization" href="dataintl.html"> <meta http-equiv="X-Translated-By" content="Google"> <meta http-equiv="X-Translated-To" content="iw"> <script type="text/javascript" src="https://www.gstatic.com/_/translate_http/_/js/k=translate_http.tr.en_GB.omlEigW4xY8.O/am=DgY/d=1/rs=AN8SPfpjsL9kUWY0h-sp7Ilu7hZWGwEmeg/m=corsproxy" data-sourceurl="https://firefox-source-docs.mozilla.org/intl/icu.html"></script> <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" rel="stylesheet"> <script type="text/javascript" src="https://www.gstatic.com/_/translate_http/_/js/k=translate_http.tr.en_GB.omlEigW4xY8.O/am=DgY/d=1/exm=corsproxy/ed=1/rs=AN8SPfpjsL9kUWY0h-sp7Ilu7hZWGwEmeg/m=phishing_protection" data-phishing-protection-enabled="false" data-forms-warning-enabled="true" data-source-url="https://firefox-source-docs.mozilla.org/intl/icu.html"></script> <meta name="robots" content="none"> </head> <body class="wy-body-for-nav"> <script type="text/javascript" src="https://www.gstatic.com/_/translate_http/_/js/k=translate_http.tr.en_GB.omlEigW4xY8.O/am=DgY/d=1/exm=corsproxy,phishing_protection/ed=1/rs=AN8SPfpjsL9kUWY0h-sp7Ilu7hZWGwEmeg/m=navigationui" data-environment="prod" data-proxy-url="https://firefox--source--docs-mozilla-org.translate.goog" data-proxy-full-url="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB" data-source-url="https://firefox-source-docs.mozilla.org/intl/icu.html" data-source-language="pl" data-target-language="iw" data-display-language="en-GB" data-detected-source-language="" data-is-source-untranslated="false" data-source-untranslated-url="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://firefox-source-docs.mozilla.org/intl/icu.html&anno=2" data-client="tr"></script> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search"><a href="https://firefox--source--docs-mozilla-org.translate.goog/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB" class="icon icon-home"> Firefox Source Docs <img src="../_static/firefox-wordmark.svg" class="logo" alt="Logo"> </a><!-- -- This code is governed by the BSD license ----> <div> <h3>Quick search</h3> <script> (function () { var cx = "dd12886298f75dbef"; var gcse = document.createElement("script"); gcse.async = true; gcse.src = "https://cse.google.com/cse.js?cx=" + cx; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(gcse, s); })(); </script><gcse:search></gcse:search> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> <p class="caption" role="heading"><span class="caption-text">Overview</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/glossary/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">A Glossary of Common Terms</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/overview/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">A Quick Guide to Mozilla Applications</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Getting Started</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/setup/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Getting Set Up To Work On The Firefox Codebase</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Working On Firefox</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/contributing/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Working on Firefox</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/bug-mgmt/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Bug Handling</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Firefox User Guide</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/devtools-user/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Firefox DevTools User Docs</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Source Code Documentation</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/mots/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Governance</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/browser/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Firefox Front-end</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/dom/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">DOM</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/editor/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Editor</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/layout/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Style system (CSS) & Layout</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/gfx/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Graphics</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/ipc/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Processes, Threads and IPC</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/devtools/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Firefox DevTools Contributor Docs</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/toolkit/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Toolkit</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/js/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">SpiderMonkey</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/mobile/android/geckoview/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">GeckoView</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/mobile/android/fenix/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Fenix</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/mobile/android/focus-android/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Focus for Android</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/dom/bindings/webidl/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">WebIDL</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/modules/libpref/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">libpref</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/networking/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Networking</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/remote/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Remote Protocols</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/services/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Services</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/uriloader/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">File Handling</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/widget/cocoa/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Firefox on macOS</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/widget/windows/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Firefox on Windows</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/toolkit/components/ml/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Firefox AI Platform</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/accessible/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Accessibility</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/code-quality/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Code quality</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/writing-rust-code/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Writing Rust Code</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/rust-components/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Rust Components</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/tools/profiler/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Gecko Profiler</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/performance/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Performance</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/storage/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Database bindings (SQLite, KV, …)</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/xpcom/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">XPCOM</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/nspr/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">NSPR</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/security/nss/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Network Security Services (NSS)</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/content-security/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Web Security Checks in Gecko</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">The Firefox Build System</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/mach/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Mach</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/tools/try/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Pushing to Try</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/build/buildsystem/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Build System</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/taskcluster/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Firefox CI and Taskgraph</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/tools/moztreedocs/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Managing Documentation</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/mozbuild/vendor/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Vendoring Third Party Components</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Testing & Test Infrastructure</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/automated-testing/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Automated Testing</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/treeherder-try/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Understanding Treeherder Results</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/sheriffed-intermittents/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Sheriffed intermittent failures</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/tests-for-new-config/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Turning on Firefox tests for a new configuration</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/intermittent/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Avoiding intermittent tests</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/testing-policy/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Testing Policy</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/ci-configs/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Configuration Changes</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/browser-chrome/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Browser chrome mochitests</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/chrome-tests/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Chrome Tests</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/marionette/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Marionette</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/geckodriver/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">geckodriver</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/test-verification/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Test Verification</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/webrender/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">WebRender Tests</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/mochitest-plain/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Mochitest</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/xpcshell/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">XPCShell tests</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/tps/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">TPS</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/web-platform/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">web-platform-tests</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/gtest/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">GTest</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/tools/fuzzing/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Fuzzing</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/tools/sanitizer/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Sanitizer</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing/perfdocs/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Performance Testing</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/tools/code-coverage/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Code coverage</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/testing-rust-code/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Testing & Debugging Rust Code</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Releases & Updates</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/update-infrastructure/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Mozilla Update Infrastructure</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/update-infrastructure/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#watershed-updates">Watershed Updates</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/update-infrastructure/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#desupport-updates">Desupport Updates</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Localization & Internationalization</span></p> <ul class="current"> <li class="toctree-l1 current"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Internationalization</a> <ul class="current"> <li class="toctree-l2"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/locale.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Locale management</a></li> <li class="toctree-l2"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/dataintl.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">UI Internationalization</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#">ICU</a> <ul> <li class="toctree-l3"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#introduction">Introduction</a></li> <li class="toctree-l3"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#internationalization-in-spidermonkey-and-gecko">Internationalization in SpiderMonkey and Gecko</a></li> <li class="toctree-l3"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#building-spidermonkey-or-gecko-with-icu">Building SpiderMonkey or Gecko with ICU</a></li> <li class="toctree-l3"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#using-icu-functionality-in-spidermonkey-and-gecko">Using ICU functionality in SpiderMonkey and Gecko</a></li> <li class="toctree-l3"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#spidermonkey-and-geckos-imported-icu">SpiderMonkey and Gecko’s imported ICU</a> <ul> <li class="toctree-l4"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#build-system">Build system</a></li> <li class="toctree-l4"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#locale-and-time-zone-data">Locale and time zone data</a></li> <li class="toctree-l4"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#local-patching-of-icu-and-cldr">Local patching of ICU and CLDR</a></li> <li class="toctree-l4"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-imported-code">Updating imported code</a></li> </ul></li> </ul></li> <li class="toctree-l2"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu4x.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">ICU4X</a></li> </ul></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/l10n/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Localization</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Firefox and Python</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/mozbase/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">mozbase</a></li> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/python/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Using third-party Python packages</a></li> </ul> <p class="caption" role="heading"><span class="caption-text">Metrics Collected in Firefox</span></p> <ul> <li class="toctree-l1"><a class="reference internal" href="https://firefox--source--docs-mozilla-org.translate.goog/metrics/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Metrics</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" aria-label="Mobile navigation menu"><i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="https://firefox--source--docs-mozilla-org.translate.goog/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Firefox Source Docs</a> </nav> <div class="wy-nav-content"> <div class="rst-content"><!-- This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this file, - You can obtain one at http://mozilla.org/MPL/2.0/. --> <div role="navigation" aria-label="Page navigation"> <ul class="wy-breadcrumbs"> <li><a href="https://firefox--source--docs-mozilla-org.translate.goog/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB" class="icon icon-home" aria-label="Home"></a></li> <li class="breadcrumb-item"><a href="https://firefox--source--docs-mozilla-org.translate.goog/intl/index.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB">Internationalization</a></li> <li class="breadcrumb-item active">ICU</li> <li class="wy-breadcrumbs-aside"><a href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://bugzilla.mozilla.org/enter_bug.cgi?product%3DDeveloper%2BInfrastructure%26component%3DFirefox%2BSource%2BDocs%253A%2BContent%26short_desc%3DDocumentation%2Bissue%2Bon%2Bintl/icu%26comment%3DURL%2B%3D%2Bhttps://firefox-source-docs.mozilla.org/intl/icu.html%26bug_file_loc%3Dhttps://firefox-source-docs.mozilla.org/intl/icu.html" rel="nofollow">Report an issue</a> / <a href="https://firefox--source--docs-mozilla-org.translate.goog/_sources/intl/icu.rst.txt?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB" rel="nofollow"> View page source</a></li> </ul> <hr> </div> <div role="main" class="document" itemscope itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <section id="icu"> <h1>ICU<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#icu" title="Link to this heading">¶</a></h1> <section id="introduction"> <h2>Introduction<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#introduction" title="Link to this heading">¶</a></h2> <p>Internationalization (i18n, “i” then 18 letters then “n”) is the process of handling data with respect to a particular locale:</p> <ul class="simple"> <li><p>The number 5 representing five US dollars might be formatted as</p> <ul> <li><p>“$5.00” in American English,</p></li> <li><p>“US$5.00” in Canadian English, or</p></li> <li><p>“5,00 $US” in French.</p></li> </ul></li> <li><p>A list of people’s names in a phone book would sort</p> <ul> <li><p>in English alphabetically; but</p></li> <li><p>in German, where “ä”/“ö”/“ü” are often interchangeable with “ae”/“oe”/“ue”, alphabetically but with vowels with umlauts treated as their two-vowel counterparts.</p></li> </ul></li> <li><p>The currency whose code is “CHF” might be formatted as</p> <ul> <li><p>“Swiss Franc” in English, but</p></li> <li><p>“franc suisse” in French.</p></li> </ul></li> <li><p>The Unix time 1590803313070 might format as the time string</p> <ul> <li><p>“9:48:33 PM Eastern Daylight Time” in American English, but</p></li> <li><p>“21:48:33 Nordamerikanische Ostküsten-Sommerzeit” in German.</p></li> </ul></li> </ul> <p>i18n encompasses far more than this, but you get the basic idea.</p> </section> <section id="internationalization-in-spidermonkey-and-gecko"> <h2>Internationalization in SpiderMonkey and Gecko<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#internationalization-in-spidermonkey-and-gecko" title="Link to this heading">¶</a></h2> <p>SpiderMonkey implements extensive i18n capabilities through the <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://tc39.es/ecma402/">ECMAScript Internationalization API</a> and the global <code class="docutils literal notranslate"><span class="pre">Intl</span></code> object. Gecko requires i18n capabilities to implement text shaping, sort operations in some contexts, and various other features.</p> <p>SpiderMonkey and Gecko use <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=http://site.icu-project.org/">ICU</a>, Internationalization Components for Unicode, to implement many low-level i18n operations. (Line breaking, implemented instead in <code class="docutils literal notranslate"><span class="pre">intl/lwbrk</span></code>, is a notable exception.) Gecko and SpiderMonkey also use ICU’s implementations of certain i18n-<em>adjacent</em> operations (for example, Unicode normalization).</p> <p>ICU date/time formatting functionality requires extensive knowledge of time zone names and when zone transitions occur. The IANA <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> database supplies this information.</p> <p>A final note of caution: ICU carefully depends upon an exact Unicode version. Other parts of SpiderMonkey and Gecko have separate dependencies on an exact Unicode version. Updates to ICU and related components <em>must</em> be synchronized with those updates so that the entirety of SpiderMonkey, and the entirety of Gecko including SpiderMonkey within it, advance to new Unicode versions in lockstep. <a class="footnote-reference brackets" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#lockstep" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a></p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="lockstep" role="doc-footnote"><span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#id1">1</a><span class="fn-bracket">]</span></span> <p>The steps involved in updating Gecko-in-general’s Unicode version, and updating SpiderMonkey’s code dependent on Unicode version, are <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://wiki.mozilla.org/I18n:Updating_Unicode_version">documented on WikiMO</a>.</p> </aside> </aside> </section> <section id="building-spidermonkey-or-gecko-with-icu"> <h2>Building SpiderMonkey or Gecko with ICU<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#building-spidermonkey-or-gecko-with-icu" title="Link to this heading">¶</a></h2> <p>SpiderMonkey and Gecko can be built using either a periodically-updated copy of ICU in <code class="docutils literal notranslate"><span class="pre">intl/icu/source</span></code> (using time zone data in <code class="docutils literal notranslate"><span class="pre">intl/tzdata/source</span></code>), or using a system-provided ICU library (dependent on its own <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> information). Pass <code class="docutils literal notranslate"><span class="pre">--with-system-icu</span></code> when configuring to use system ICU. (Using system ICU will disable some <code class="docutils literal notranslate"><span class="pre">Intl</span></code> functionality, such as historically accurate time zone calculations, that can’t be readily supported without a precisely-controlled ICU.) ICU version requirements advance fairly quickly as Gecko depends on features and bug fixes in newer ICU releases. You’ll get a build error if you try to use an unsupported ICU.</p> <p>SpiderMonkey’s <code class="docutils literal notranslate"><span class="pre">Intl</span></code> API may be built or disabled by configuring <code class="docutils literal notranslate"><span class="pre">--with-intl-api</span></code> (the default) or <code class="docutils literal notranslate"><span class="pre">--without-intl-api</span></code>. SpiderMonkey built without the <code class="docutils literal notranslate"><span class="pre">Intl</span></code> API doesn’t require ICU. However, if you build without the <code class="docutils literal notranslate"><span class="pre">Intl</span></code> API, some non-<code class="docutils literal notranslate"><span class="pre">Intl</span></code> JavaScript functionality will not exist (<code class="docutils literal notranslate"><span class="pre">String.prototype.normalize</span></code>) or won’t fully work (for example, <code class="docutils literal notranslate"><span class="pre">String.prototype.toLocale{Lower,Upper}Case</span></code> will not respect a provided locale, and the various <code class="docutils literal notranslate"><span class="pre">toLocaleString</span></code> functions have best-effort behavior).</p> </section> <section id="using-icu-functionality-in-spidermonkey-and-gecko"> <h2>Using ICU functionality in SpiderMonkey and Gecko<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#using-icu-functionality-in-spidermonkey-and-gecko" title="Link to this heading">¶</a></h2> <p>ICU headers are considered system headers by the Gecko build system, so they must be listed in <code class="docutils literal notranslate"><span class="pre">config/system-headers.mozbuild</span></code>. Code that wishes to use ICU functionality may use <code class="docutils literal notranslate"><span class="pre">#include</span> <span class="pre">"unicode/unorm.h"</span></code> or similar to do so.</p> <p>Gecko and SpiderMonkey code may use ICU’s stable C API (ICU4C). These functions are stable and shouldn’t change as ICU updates occur. (ICU4C’s <code class="docutils literal notranslate"><span class="pre">enum</span></code> initializers are not always stable: while initializer values are stable, new initializers are sometimes added, perhaps behind <code class="docutils literal notranslate"><span class="pre">#ifdef</span> <span class="pre">U_HIDE_DRAFT_API</span></code>. This may be necessary for exhaustive <code class="docutils literal notranslate"><span class="pre">switch</span></code>es to add <code class="docutils literal notranslate"><span class="pre">#ifdef</span></code>s around some <code class="docutils literal notranslate"><span class="pre">case</span></code>s.)</p> <p>Gecko and SpiderMonkey are strongly discouraged from using ICU’s C++ API (unfortunately including all smart pointer classes), because the C++ API doesn’t provide ICU4C’s compatibility guarantees. Rarely, we tolerate C++ API use when no stable option exists. But the API has to “look” reasonably stable, and we usually want to start a discussion with upstream about adding a stable API to eventually use. Use symbols from <code class="docutils literal notranslate"><span class="pre">namespace</span> <span class="pre">icu</span></code> to access ICU C++ functionality. <em>Talk to the current imported-ICU owner (presently Jeff Walden) before you start doing any of this!</em></p> </section> <section id="spidermonkey-and-geckos-imported-icu"> <h2>SpiderMonkey and Gecko’s imported ICU<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#spidermonkey-and-geckos-imported-icu" title="Link to this heading">¶</a></h2> <section id="build-system"> <h3>Build system<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#build-system" title="Link to this heading">¶</a></h3> <p>The system for building ICU lives in <code class="docutils literal notranslate"><span class="pre">config/external/icu</span></code> and <code class="docutils literal notranslate"><span class="pre">intl/icu/icu_sources_data.py</span></code>. We generate a Mozilla-compatible build system rather than using ICU’s build system. The build system is shared by SpiderMonkey and Gecko both.</p> <p>ICU includes functionality we never use, so we don’t naively compile all of it. We extract the list of files to compile from <code class="docutils literal notranslate"><span class="pre">intl/icu/source/{common,i18n}/Makefile.in</span></code> and then apply a manually-maintained list of unused files (stored in <code class="docutils literal notranslate"><span class="pre">intl/icu_sources_data.py</span></code>) when we update ICU.</p> </section> <section id="locale-and-time-zone-data"> <h3>Locale and time zone data<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#locale-and-time-zone-data" title="Link to this heading">¶</a></h3> <p>ICU contains a considerable amount of raw locale data: formatting characteristics for each locale, strings for things like currencies and languages for each locale, localized time zone specifiers, and so on. This data lives in human-readable files in <code class="docutils literal notranslate"><span class="pre">intl/icu/source/data</span></code>. Time zone data in <code class="docutils literal notranslate"><span class="pre">intl/tzdata/source</span></code> is stored in partially-compiled formats (some of them only partly human-readable).</p> <p>However, a normal Gecko build never uses these files! Instead, both ICU and <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> data are precompiled into a large, endian-specific <code class="docutils literal notranslate"><span class="pre">icudtNNE.dat</span></code> (<code class="docutils literal notranslate"><span class="pre">NN</span></code> = ICU version, <code class="docutils literal notranslate"><span class="pre">E</span></code> = endianness) file. <a class="footnote-reference brackets" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#why-icudt-not-rebuilt-every-time" id="id2" role="doc-noteref"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></a> That file is added to <code class="docutils literal notranslate"><span class="pre">config/external/icu/data/</span></code> and is checked into the Mozilla tree, to be directly incorporated into Gecko/SpiderMonkey builds. For size reasons, only the little-endian version is checked into the tree. It is converted into a big-endian version when necessary during the build.</p> <p>ICU’s locale data covers <em>all</em> ICU internationalization features, including ones we never need. We trim locale data to size with a <code class="docutils literal notranslate"><span class="pre">intl/icu/data_filter.json</span></code> <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://github.com/unicode-org/icu/blob/master/docs/userguide/icu_data/buildtool.md">data filter</a> when compiling <code class="docutils literal notranslate"><span class="pre">icudtNNE.dat</span></code>. Removing <em>too much</em> data won’t <em>necessarily</em> break the build, so it’s important that we have automated tests for the locale data we actually use in order to detect mistakes.</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="why-icudt-not-rebuilt-every-time" role="doc-footnote"><span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#id2">2</a><span class="fn-bracket">]</span></span> <p><code class="docutils literal notranslate"><span class="pre">icudtNNE.dat</span></code> isn’t compiled during a SpiderMonkey/Gecko build because it would require ICU command-line tools. And it’s a pain to either compile and run them during the build, or to require them as build dependencies.</p> </aside> </aside> </section> <section id="local-patching-of-icu-and-cldr"> <h3>Local patching of ICU and CLDR<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#local-patching-of-icu-and-cldr" title="Link to this heading">¶</a></h3> <p>We generally don’t patch our copy of ICU except for compelling need. When we do patch, we usually only apply reasonably small patches that have been reviewed and landed upstream (so that our patch will be obsolete when we next update ICU).</p> <p>Local patches are stored in the <code class="docutils literal notranslate"><span class="pre">intl/icu-patches</span></code> directory. They’re applied when ICU is updated, so merely updating ICU files in place won’t persist changes across an ICU update.</p> <p>Patching ICU also allows for patching some parts and uses of CLDR, the data backing ICU operations. Note that this does not include character data, which is <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://wiki.mozilla.org/I18n:Updating_Unicode_version">updated separately</a>, and that any such patching does not affect any other CLDR uses. In particular, Fluent localization depends on Rust crates which themselves depend on CLDR data directly and separately from ICU. Any CLDR patches should remain reasonably small; larger changes such as adding support for a new locale should be done upstream.</p> </section> <section id="updating-imported-code"> <h3>Updating imported code<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-imported-code" title="Link to this heading">¶</a></h3> <p>The process of updating imported i18n-relevant code is <em>semi</em>-automated. We use a series of shell and Python scripts to do the job.</p> <section id="updating-icu"> <h4>Updating ICU<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-icu" title="Link to this heading">¶</a></h4> <p>New ICU versions are announced on the <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://lists.sourceforge.net/lists/listinfo/icu-announce">icu-announce</a> mailing list. Both release candidates and actual releases are announced here. It’s a good idea to attempt to update ICU when a release candidate is announced, just in case some serious problem is present (especially one that would be painful to fix through local patching).</p> <p><code class="docutils literal notranslate"><span class="pre">intl/update-icu.sh</span></code> updates our ICU to a given ICU release: <a class="footnote-reference brackets" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#icu-git-argument" id="id3" role="doc-noteref"><span class="fn-bracket">[</span>3<span class="fn-bracket">]</span></a></p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/intl"</span> $<span class="w"> </span><span class="c1"># Ensure certain Python modules in the tree are accessible when updating.</span> $<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">PYTHONPATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/python/mozbuild/"</span> $<span class="w"> </span><span class="c1"># <URL to ICU Git> <release tag name></span> $<span class="w"> </span>./update-icu.sh<span class="w"> </span>https://github.com/unicode-org/icu.git<span class="w"> </span>release-67-1 </pre> </div> </div> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="icu-git-argument" role="doc-footnote"><span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#id3">3</a><span class="fn-bracket">]</span></span> <p>The ICU Git URL argument lets you update from a local ICU clone. This can speed up work when you’re updating to a new ICU release and need to adjust or add new local patches.</p> </aside> </aside> <p>But usually you’ll want to update to the latest commit from the corresponding ICU maintenance branch so that you pick up fixes landed post-release:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/intl"</span> $<span class="w"> </span><span class="c1"># Ensure certain Python modules in the tree are accessible when updating.</span> $<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">PYTHONPATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/python/mozbuild/"</span> $<span class="w"> </span><span class="c1"># <URL to ICU Git> <maintenance name></span> $<span class="w"> </span>./update-icu.sh<span class="w"> </span>https://github.com/unicode-org/icu.git<span class="w"> </span>maint/maint-67 </pre> </div> </div> <p>Updating ICU will also update the language tag registry (which records language tag semantics needed to correctly implement <code class="docutils literal notranslate"><span class="pre">Intl</span></code> functionality). Therefore it’s likely necessary to update SpiderMonkey’s language tag handling after running this <a class="footnote-reference brackets" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#update-icu-warning-langtags" id="id4" role="doc-noteref"><span class="fn-bracket">[</span>4<span class="fn-bracket">]</span></a>. See below where the <code class="docutils literal notranslate"><span class="pre">langtags</span></code> mode of <code class="docutils literal notranslate"><span class="pre">make_intl_data.py</span></code> is discussed.</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="update-icu-warning-langtags" role="doc-footnote"><span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#id4">4</a><span class="fn-bracket">]</span></span> <p><code class="docutils literal notranslate"><span class="pre">update-icu.sh</span></code> will print a notice as a reminder of this:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>INFO:<span class="w"> </span>Please<span class="w"> </span>run<span class="w"> </span><span class="s1">'js/src/builtin/intl/make_intl_data.py langtags'</span><span class="w"> </span>to<span class="w"> </span>update<span class="w"> </span>additional<span class="w"> </span>language<span class="w"> </span>tag<span class="w"> </span>files<span class="w"> </span><span class="k">for</span><span class="w"> </span>SpiderMonkey. </pre> </div> </div> </aside> </aside> <p><code class="docutils literal notranslate"><span class="pre">update-icu.sh</span></code> is intended for <em>replayability</em>, not for hands-off runnability. It downloads ICU source, prunes various irrelevant files, replaces <code class="docutils literal notranslate"><span class="pre">intl/icu/source</span></code> with the new files – and then blindly applies local patches in fixed order.</p> <p>Often a local patch won’t apply, or new patches must be applied to successfully build. In this case you’ll have to manually edit <code class="docutils literal notranslate"><span class="pre">update-icu.sh</span></code> to abort after only <em>some</em> patches have been applied, make whatever changes are necessary by hand, generate a new/updated patch file by hand, then carefully reattempt updating. (The people who have updated ICU in the past, usually jwalden and anba, follow this awkward process and don’t have good ideas on how to improve it.)</p> <p>Any time ICU is updated, you’ll need to fully rebuild whichever of SpiderMonkey or Gecko you’re building. For SpiderMonkey, delete your object directory and reconfigure from scratch. For Gecko, change the message in the top-level <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://searchfox.org/mozilla-central/source/CLOBBER">CLOBBER</a> file.</p> </section> <section id="updating-tzdata"> <h4>Updating tzdata<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-tzdata" title="Link to this heading">¶</a></h4> <p>ICU contains a copy of <code class="docutils literal notranslate"><span class="pre">tzdata</span></code>, but that copy is whatever <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> release was current at the time the ICU release was finalized. Time zone data changes much more often than that: every time some national legislature or tinpot dictator decides to alter time zones. <a class="footnote-reference brackets" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#tzdata-release-frequency" id="id5" role="doc-noteref"><span class="fn-bracket">[</span>5<span class="fn-bracket">]</span></a> The <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://mm.icann.org/pipermail/tz-announce/">tz-announce</a> mailing list announces changes as they occur. (Note that we can’t <em>immediately</em> update when a release occurs: ICU’s <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://github.com/unicode-org/icu-data">icu-data</a> repository must be updated before we can update our <code class="docutils literal notranslate"><span class="pre">tzdata</span></code>.)</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="tzdata-release-frequency" role="doc-footnote"><span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#id5">5</a><span class="fn-bracket">]</span></span> <p>To give a sense of how frequently <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> is updated, and the irregularity of releases over time:</p> <ul class="simple"> <li><p>2019 had three <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> releases, 2019a through 2019c.</p></li> <li><p>2018 had nine <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> releases, 2018a through 2018i.</p></li> <li><p>2017 had three <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> releases, 2017a through 2017c.</p></li> </ul> </aside> </aside> <p>Therefore, either (usually) after you update ICU <em>or</em> when a new <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> release occurs, you’ll need to update our imported <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> files. (If you do need to update time zone data, note that you’ll also need to additionally update SpiderMonkey’s time zone handling, described further below.) This also suitably updates <code class="docutils literal notranslate"><span class="pre">config/external/icu/data/icudtNNE.dat</span></code>. (If you’ve just run <code class="docutils literal notranslate"><span class="pre">update-icu.sh</span></code>, it will warn you that you need to do this. <a class="footnote-reference brackets" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#update-icu-warning-old-tzdata" id="id6" role="doc-noteref"><span class="fn-bracket">[</span>6<span class="fn-bracket">]</span></a>)</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="update-icu-warning-old-tzdata" role="doc-footnote"><span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#id6">6</a><span class="fn-bracket">]</span></span> <p>For example:</p> <div class="highlight-default notranslate"> <div class="highlight"> <pre><span></span><span class="n">WARN</span><span class="p">:</span> <span class="n">Local</span> <span class="n">tzdata</span> <span class="p">(</span><span class="mi">2020</span><span class="n">a</span><span class="p">)</span> <span class="ow">is</span> <span class="n">newer</span> <span class="n">than</span> <span class="n">ICU</span> <span class="n">tzdata</span> <span class="p">(</span><span class="mi">2019</span><span class="n">c</span><span class="p">),</span> <span class="n">please</span> <span class="n">run</span> <span class="s1">'./update-tzdata.sh 2020a'</span> </pre> </div> </div> </aside> </aside> <p>First, make sure you have a usable <code class="docutils literal notranslate"><span class="pre">icupkg</span></code> on your system. <a class="footnote-reference brackets" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#icupkg-on-system" id="id7" role="doc-noteref"><span class="fn-bracket">[</span>7<span class="fn-bracket">]</span></a> Then run the <code class="docutils literal notranslate"><span class="pre">update-tzdata.sh</span></code> script to update <code class="docutils literal notranslate"><span class="pre">intl/tzdata</span></code> and <code class="docutils literal notranslate"><span class="pre">icudtNNE.dat</span></code>:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/intl"</span> $<span class="w"> </span>./update-tzdata.sh<span class="w"> </span>2020a<span class="w"> </span><span class="c1"># or whatever the latest release is</span> </pre> </div> </div> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="icupkg-on-system" role="doc-footnote"><span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#id7">7</a><span class="fn-bracket">]</span></span> <p>To install <code class="docutils literal notranslate"><span class="pre">icupkg</span></code> on your system:</p> <ul class="simple"> <li><p>On Fedora, use <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">dnf</span> <span class="pre">install</span> <span class="pre">icu</span></code>.</p></li> <li><p>On Ubuntu, use <code class="docutils literal notranslate"><span class="pre">sudo</span> <span class="pre">apt-get</span> <span class="pre">install</span> <span class="pre">icu-devtools</span></code>.</p></li> <li><p>On Mac OS X, use <code class="docutils literal notranslate"><span class="pre">brew</span> <span class="pre">install</span> <span class="pre">icu4c</span></code>.</p></li> <li><p>On Windows, you’ll need to <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://github.com/unicode-org/icu/releases/tag/release-67-1">download a binary build of ICU for Windows</a> and use the <code class="docutils literal notranslate"><span class="pre">bin/icupkg.exe</span></code> or <code class="docutils literal notranslate"><span class="pre">bin64/icupkg.exe</span></code> utility inside it.</p></li> </ul> <p>If you’re on Windows, or for some reason you don’t want to use the <code class="docutils literal notranslate"><span class="pre">icupkg</span></code> now in your <code class="docutils literal notranslate"><span class="pre">$PATH</span></code>, you can manually specify it on the command line using the <code class="docutils literal notranslate"><span class="pre">-e</span> <span class="pre">/path/to/icupkg</span></code> flag:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/intl"</span> $<span class="w"> </span>./update-tzdata.sh<span class="w"> </span>-e<span class="w"> </span>/path/to/icupkg<span class="w"> </span>2020a<span class="w"> </span><span class="c1"># or whatever the latest release is</span> </pre> </div> </div> <p><em>In principle</em>, the <code class="docutils literal notranslate"><span class="pre">icupkg</span></code> you use <em>should</em> be the one from the ICU release/maintenance branch being built: if there’s a mismatch, you might encounter an ICU “format version not supported” error. If you’re on Windows, make sure to download a binary build for that release/branch. On other platforms, you might have to build your own ICU from source. The steps required to do this are left as an exercise for the reader. (In the somewhat longer term, the update commands might be changed to do this themselves.)</p> </aside> </aside> <p>If <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> must be updated on trunk, you’ll almost certainly have to backport the update to Beta and ESR. Don’t attempt to backport the literal patch; just run the appropriate commands documented here to do so.</p> </section> <section id="updating-spidermonkey-intl-data"> <h4>Updating SpiderMonkey <code class="docutils literal notranslate"><span class="pre">Intl</span></code> data<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-spidermonkey-intl-data" title="Link to this heading">¶</a></h4> <p>SpiderMonkey itself can’t blindly invoke ICU to perform every i18n operation, because sometimes ICU behavior deviates from what web specifications require. Therefore, when ICU is updated, we also must update SpiderMonkey itself as well (including various generated tests). Such updating is performed using the various modes of <code class="docutils literal notranslate"><span class="pre">js/src/builtin/make_intl_data.py</span></code>.</p> <section id="updating-spidermonkey-time-zone-handling"> <h5>Updating SpiderMonkey time zone handling<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-spidermonkey-time-zone-handling" title="Link to this heading">¶</a></h5> <p>The ECMAScript Internationalization API requires that time zone identifiers (<code class="docutils literal notranslate"><span class="pre">America/New_York</span></code>, <code class="docutils literal notranslate"><span class="pre">Antarctica/McMurdo</span></code>, etc.) be interpreted according to <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://www.iana.org/time-zones">IANA</a> semantics. Unfortunately, ICU doesn’t precisely implement those semantics. (See comments in <code class="docutils literal notranslate"><span class="pre">js/src/builtin/intl/SharedIntlData.h</span></code> for details.) Therefore SpiderMonkey has to do certain pre- and post-processing based on what’s in IANA but not in ICU, and what’s in ICU that isn’t in IANA.</p> <p>Use <code class="docutils literal notranslate"><span class="pre">make_intl_data.py</span></code>’s <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> mode to update time zone information:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/js/src/builtin/intl"</span> $<span class="w"> </span><span class="c1"># make_intl_data.py requires yaml.</span> $<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">PYTHONPATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/third_party/python/PyYAML/lib3/"</span> $<span class="w"> </span>python3<span class="w"> </span>./make_intl_data.py<span class="w"> </span>tzdata </pre> </div> </div> <p>The <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> mode accepts two optional arguments that generally will not be needed:</p> <ul class="simple"> <li><p><strong>``–tz``</strong> will act using data from a local <code class="docutils literal notranslate"><span class="pre">tzdata/</span></code> directory containing raw <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> source (note that this is <em>not</em> the same as what is in <code class="docutils literal notranslate"><span class="pre">intl/tzdata/source</span></code>). It may be useful to help debug problems that arise during an update.</p></li> <li><p><strong>``–ignore-backzone``</strong> will omit time zone information before 1970. SpiderMonkey and Gecko include this information by default. However, because (by deliberate policy) <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> information before 1970 is not reliable to the same degree as data since 1970, and backzone data has a size cost, a SpiderMonkey embedding or custom Gecko build might decide to omit it.</p></li> </ul> </section> <section id="updating-spidermonkey-language-tag-handling"> <h5>Updating SpiderMonkey language tag handling<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-spidermonkey-language-tag-handling" title="Link to this heading">¶</a></h5> <p>Language tags (<code class="docutils literal notranslate"><span class="pre">en</span></code>, <code class="docutils literal notranslate"><span class="pre">de-CH</span></code>, <code class="docutils literal notranslate"><span class="pre">ar-u-ca-islamicc</span></code>, and so on) are the primary means of specifying localization characteristics. The ECMAScript Internationalization API supports certain operations that depend upon the current state of the language tag registry (stored in the Unicode Common Locale Data Repository, CLDR, a repository of all locale-specific characteristics) that specifies subtag semantics:</p> <ul class="simple"> <li><p><code class="docutils literal notranslate"><span class="pre">Intl.getCanonicalLocales</span></code> and <code class="docutils literal notranslate"><span class="pre">Intl.Locale</span></code> must replace alias subtags with their preferred forms. For example, <code class="docutils literal notranslate"><span class="pre">ar-u-ca-islamic-civil</span></code> uses the preferred Islamic calendar subtag, while <code class="docutils literal notranslate"><span class="pre">ar-u-ca-islamicc</span></code> uses an alias.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">Intl.Locale.prototype.maximize</span></code> and <code class="docutils literal notranslate"><span class="pre">Intl.Locale.prototype.minimize</span></code> accept a language tag and add or remove “likely” subtags from it. For example, <code class="docutils literal notranslate"><span class="pre">de</span></code> most likely refers to German using Latin script in Germany, so it maximizes to <code class="docutils literal notranslate"><span class="pre">de-Latn-DE</span></code> – and in reverse, <code class="docutils literal notranslate"><span class="pre">de-Latn-DE</span></code> minimizes to simply <code class="docutils literal notranslate"><span class="pre">de</span></code>.</p></li> </ul> <p>These decisions vary over time: as countries change <a class="footnote-reference brackets" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#soviet-union" id="id8" role="doc-noteref"><span class="fn-bracket">[</span>8<span class="fn-bracket">]</span></a>, as customs change, as language prevalence in regions varies, etc.</p> <aside class="footnote-list brackets"> <aside class="footnote brackets" id="soviet-union" role="doc-footnote"><span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#id8">8</a><span class="fn-bracket">]</span></span> <p>For just one relevant example, the breakup of the Soviet Union is the cause of numerous entries in the language tag registry. <code class="docutils literal notranslate"><span class="pre">ru-SU</span></code>, Russian as used in the Soviet Union, is now expressed as <code class="docutils literal notranslate"><span class="pre">ru-RU</span></code>, Russian as used in Russia; <code class="docutils literal notranslate"><span class="pre">ab-SU</span></code>, Abkhazian as used in the Soviet Union, is now expressed as <code class="docutils literal notranslate"><span class="pre">ab-GE</span></code>, Abkhazian as used in Georgia; and so on for all the other satellite states.</p> </aside> </aside> <p>Use <code class="docutils literal notranslate"><span class="pre">make_intl_data.py</span></code>’s <code class="docutils literal notranslate"><span class="pre">langtags</span></code> mode to update language tag information to the same CLDR version used by ICU:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/js/src/builtin/intl"</span> $<span class="w"> </span><span class="c1"># make_intl_data.py requires yaml.</span> $<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">PYTHONPATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/third_party/python/PyYAML/lib3/"</span> $<span class="w"> </span>python3<span class="w"> </span>./make_intl_data.py<span class="w"> </span>langtags </pre> </div> </div> <p>The CLDR version used will be printed in the header of CLDR-sensitive generated files. For example, <code class="docutils literal notranslate"><span class="pre">intl/components/src/LocaleGenerated.cpp</span></code> currently begins with:</p> <div class="highlight-cpp notranslate"> <div class="highlight"> <pre><span></span><span class="c1">// Generated by make_intl_data.py. DO NOT EDIT.</span> <span class="c1">// Version: CLDR-37</span> <span class="c1">// URL: https://unicode.org/Public/cldr/37/core.zip</span> </pre> </div> </div> </section> <section id="updating-spidermonkey-currency-support"> <h5>Updating SpiderMonkey currency support<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-spidermonkey-currency-support" title="Link to this heading">¶</a></h5> <p>Currencies use different numbers of fractional digits in their preferred formatting. Most currencies use two decimal digits; a handful use no fractional digits or some other number. Currency fractional digit is maintained by ISO and must be updated as currencies change their preferred fractional digits or new currencies arise that don’t use two decimal digits.</p> <p>Currency updates are fairly uncommon, so it’ll be rare to need to update currency info. A <a class="reference external" href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://www.currency-iso.org/en/home/amendments/newsletter.html">newsletter</a> periodically sends updates about changes.</p> <p>Use <code class="docutils literal notranslate"><span class="pre">make_intl_data.py</span></code>’s <code class="docutils literal notranslate"><span class="pre">currency</span></code> mode to update currency fractional digit information:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/js/src/builtin/intl"</span> $<span class="w"> </span><span class="c1"># make_intl_data.py requires yaml.</span> $<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">PYTHONPATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/third_party/python/PyYAML/lib3/"</span> $<span class="w"> </span>python3<span class="w"> </span>./make_intl_data.py<span class="w"> </span>currency </pre> </div> </div> </section> <section id="updating-spidermonkey-measurement-formatting-support"> <h5>Updating SpiderMonkey measurement formatting support<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-spidermonkey-measurement-formatting-support" title="Link to this heading">¶</a></h5> <p>The <code class="docutils literal notranslate"><span class="pre">Intl</span></code> API supports formatting numbers as measurement units (for example, “17 meters” or “42 meters per second”). It specifies a list of units that must be supported, that we centrally record in <code class="docutils literal notranslate"><span class="pre">js/src/builtin/intl/SanctionedSimpleUnitIdentifiers.yaml</span></code>, that we verify are supported by ICU and generate supporting files from.</p> <p>If <code class="docutils literal notranslate"><span class="pre">Intl</span></code>’s list of supported units is ever updated, two separate changes will be required.</p> <p>First, <code class="docutils literal notranslate"><span class="pre">intl/icu/data_filter.json</span></code> must be updated to incorporate localized strings for the new unit. These strings are stored in <code class="docutils literal notranslate"><span class="pre">icudtNNE.dat</span></code>, so you’ll have to re-update ICU (and likely reimport <code class="docutils literal notranslate"><span class="pre">tzdata</span></code> as well, if it’s been updated since the last ICU update) to rewrite that file.</p> <p>Second, use <code class="docutils literal notranslate"><span class="pre">make_intl_data.py</span></code>’s <code class="docutils literal notranslate"><span class="pre">units</span></code> mode to update unit handling and associated tests in SpiderMonkey:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/js/src/builtin/intl"</span> $<span class="w"> </span><span class="c1"># make_intl_data.py requires yaml.</span> $<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">PYTHONPATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/third_party/python/PyYAML/lib3/"</span> $<span class="w"> </span>python3<span class="w"> </span>./make_intl_data.py<span class="w"> </span>units </pre> </div> </div> </section> <section id="updating-spidermonkey-numbering-systems-support"> <h5>Updating SpiderMonkey numbering systems support<a class="headerlink" href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB#updating-spidermonkey-numbering-systems-support" title="Link to this heading">¶</a></h5> <p>The <code class="docutils literal notranslate"><span class="pre">Intl</span></code> API also supports formatting numbers in various numbering systems (for example, “123“ using Latin numbers or “一二三“ using Han decimal numbers). The list of numbering systems that we must support is stored in <code class="docutils literal notranslate"><span class="pre">js/src/builtin/intl/NumberingSystems.yaml</span></code>. We verify these numbering systems are supported by ICU and generate supporting files from it.</p> <p>When the list of supported numbering systems needs to be updated, run <code class="docutils literal notranslate"><span class="pre">make_intl_data.py</span></code> with the <code class="docutils literal notranslate"><span class="pre">numbering</span></code> mode to update it and associated tests in SpiderMonkey:</p> <div class="highlight-bash notranslate"> <div class="highlight"> <pre><span></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/js/src/builtin/intl"</span> $<span class="w"> </span><span class="c1"># make_intl_data.py requires yaml.</span> $<span class="w"> </span><span class="nb">export</span><span class="w"> </span><span class="nv">PYTHONPATH</span><span class="o">=</span><span class="s2">"</span><span class="nv">$topsrcdir</span><span class="s2">/third_party/python/PyYAML/lib3/"</span> $<span class="w"> </span>python3<span class="w"> </span>./make_intl_data.py<span class="w"> </span>numbering </pre> </div> </div> </section> </section> </section> </section> </section> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="Footer"><a href="https://firefox--source--docs-mozilla-org.translate.goog/intl/dataintl.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB" class="btn btn-neutral float-left" title="UI Internationalization" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> <a href="https://firefox--source--docs-mozilla-org.translate.goog/intl/icu4x.html?_x_tr_sl=pl&_x_tr_tl=iw&_x_tr_hl=en-GB" class="btn btn-neutral float-right" title="ICU4X" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> </div> <hr> <div role="contentinfo"> <p></p> </div> Built with <a href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://www.sphinx-doc.org/">Sphinx</a> using a <a href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://translate.google.com/website?sl=pl&tl=iw&hl=en-GB&u=https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> <script>function gtElInit() {var lib = new google.translate.TranslateService();lib.translatePage('pl', 'iw', function () {});}</script> <script src="https://translate.google.com/translate_a/element.js?cb=gtElInit&hl=en-GB&client=wt" type="text/javascript"></script> </body> </html>