CINXE.COM
intl | Dart package
<!DOCTYPE html> <html lang="en-us"><head><script src="https://www.googletagmanager.com/gtm.js?id=GTM-MX6DBN9" async="async"></script><script src="/static/hash-o6oemknr/js/gtm.js" async="async"></script><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="ie=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="twitter:card" content="summary"/><meta name="twitter:site" content="@dart_lang"/><meta name="twitter:description" content="Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues."/><meta name="twitter:image" content="https://pub.dev/static/hash-o6oemknr/img/pub-dev-icon-cover-image.png"/><meta property="og:type" content="website"/><meta property="og:site_name" content="Dart packages"/><meta property="og:title" content="intl | Dart package"/><meta property="og:description" content="Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues."/><meta property="og:image" content="https://pub.dev/static/hash-o6oemknr/img/pub-dev-icon-cover-image.png"/><meta property="og:url" content="https://pub.dev/packages/intl"/><title>intl | Dart package</title><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Google+Sans+Display:wght@400&family=Google+Sans+Text:wght@400;500;700&family=Google+Sans+Mono:wght@400;700&display=swap"/><link rel="shortcut icon" href="/favicon.ico?hash=nk4nss8c7444fg0chird9erqef2vkhb8"/><link rel="stylesheet" href="https://www.gstatic.com/glue/v25_0/ccb.min.css"/><link rel="search" type="application/opensearchdescription+xml" title="Dart packages" href="/osd.xml"/><link rel="canonical" href="https://pub.dev/packages/intl"/><meta name="description" content="Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues."/><link rel="alternate" type="application/atom+xml" title="Updated Packages Feed for Pub" href="/feed.atom"/><link rel="stylesheet" type="text/css" href="/static/hash-o6oemknr/material/bundle/styles.css"/><link rel="stylesheet" type="text/css" href="/static/hash-o6oemknr/css/style.css"/><script src="/static/hash-o6oemknr/material/bundle/script.min.js" defer="defer"></script><script src="/static/hash-o6oemknr/js/script.dart.js" defer="defer"></script><script src="https://www.gstatic.com/brandstudio/kato/cookie_choice_component/cookie_consent_bar.v3.js" defer="defer" data-autoload-cookie-consent-bar="true"></script><meta name="pub-page-data" content="eyJwa2dEYXRhIjp7InBhY2thZ2UiOiJpbnRsIiwidmVyc2lvbiI6IjAuMjAuMCIsImxpa2VzIjo1NTc1LCJwdWJsaXNoZXJJZCI6ImRhcnQuZGV2IiwiaXNEaXNjb250aW51ZWQiOmZhbHNlLCJpc0xhdGVzdCI6dHJ1ZX0sInNlc3Npb25Bd2FyZSI6ZmFsc2V9"/><link rel="preload" href="/static/hash-o6oemknr/highlight/highlight-with-init.js" as="script"/></head><body class="light-theme"><script src="/static/hash-o6oemknr/js/dark-init.js"></script><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MX6DBN9" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><div class="site-header"><button class="hamburger" aria-label="menu toggle"></button><a class="logo" href="/"><img class="site-logo" src="/static/hash-o6oemknr/img/pub-dev-logo.svg" alt="" width="140" height="30" role="presentation"/></a><div class="site-header-space"></div><div class="site-header-mask"></div><div class="site-header-search"><form action="/packages" method="GET"><input class="site-header-search-input" name="q" placeholder="New search..." autocomplete="on" title="Search"/></form></div><nav class="site-header-nav scroll-container"><div class="nav-login-container"><button id="-account-login" class="nav-main-button link">Sign in</button></div><div class="nav-container nav-help-container hoverable"><button class="nav-main-button">Help</button><div class="nav-hover-popup"><div class="nav-table-columns"><div class="nav-table-column"><h3>Pub.dev</h3><a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a><a class="nav-link" href="/help/scoring" rel="noopener" target="_blank">Package scoring and pub points</a></div><div class="nav-table-column"><h3>Flutter</h3><a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://flutter.dev/developing-packages/" rel="noopener" target="_blank">Developing packages and plugins</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div><div class="nav-table-column"><h3>Dart</h3><a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">Pub.dev <img class="foldable-icon" src="/static/hash-o6oemknr/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="/help/search" rel="noopener" target="_blank">Searching for packages</a><a class="nav-link" href="/help/scoring" rel="noopener" target="_blank">Package scoring and pub points</a></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">Flutter <img class="foldable-icon" src="/static/hash-o6oemknr/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="https://flutter.dev/using-packages/" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://flutter.dev/developing-packages/" rel="noopener" target="_blank">Developing packages and plugins</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div><div class="nav-container nav-help-container-mobile foldable"><h3 class="foldable-button">Dart <img class="foldable-icon" src="/static/hash-o6oemknr/img/nav-mobile-foldable-icon.svg" alt="toggle folding of the section" width="13" height="6"/></h3><div class="foldable-content"><a class="nav-link" href="https://dart.dev/guides/packages" rel="noopener" target="_blank">Using packages</a><a class="nav-link" href="https://dart.dev/tools/pub/publishing" rel="noopener" target="_blank">Publishing a package</a></div></div></nav></div><div id="banner-container"></div><main class="container"><div class="detail-wrapper -active -has-info-box"><div class="detail-banners"><a href="https://flutter.dev/docs/development/packages-and-plugins/favorites" rel="noopener" target="_blank"><img class="ff-banner ff-banner-desktop displayed-in-light-theme" src="/static/hash-o6oemknr/img/ff-banner-desktop-2x.png" alt="" width="150" height="218" title="Package is a Flutter Favorite" role="presentation"/><img class="ff-banner ff-banner-desktop displayed-in-dark-theme" src="/static/hash-o6oemknr/img/ff-banner-desktop-dark-2x.png" alt="" width="150" height="218" title="Package is a Flutter Favorite" role="presentation"/><img class="ff-banner ff-banner-mobile displayed-in-light-theme" src="/static/hash-o6oemknr/img/ff-banner-mobile-2x.png" alt="" width="94" height="116" title="Package is a Flutter Favorite" role="presentation"/><img class="ff-banner ff-banner-mobile displayed-in-dark-theme" src="/static/hash-o6oemknr/img/ff-banner-mobile-dark-2x.png" alt="" width="94" height="116" title="Package is a Flutter Favorite" role="presentation"/></a></div><div class="detail-header -is-loose"><div class="detail-container"><div class="detail-header-outer-block"><div class="detail-header-content-block"><h1 class="title">intl 0.20.0 <span class="pkg-page-title-copy"><img class="pkg-page-title-copy-icon filter-invert-on-dark" src="/static/hash-o6oemknr/img/content-copy-icon.svg" alt="copy "intl: ^0.20.0" to clipboard" width="18" height="18" title="Copy "intl: ^0.20.0" to clipboard" data-copy-content="intl: ^0.20.0" data-ga-click-event="copy-package-version"/><div class="pkg-page-title-copy-feedback"><span class="code">intl: ^0.20.0</span> copied to clipboard</div></span></h1><div class="metadata">Published <span><a class="-x-ago" href="" title="Nov 13, 2024" aria-label="14 days ago" aria-role="button" role="button" data-timestamp="1731484888889">14 days ago</a></span> • <a class="-pub-publisher" href="/publishers/dart.dev"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-o6oemknr/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>dart.dev</a><span class="package-badge" title="Package is compatible with Dart 3.">Dart 3 compatible</span></div><div class="detail-tags-and-like"><div class="detail-tags"><div class="-pub-tag-badge"><span class="tag-badge-main">SDK</span><a class="tag-badge-sub" href="/packages?q=sdk%3Adart" rel="nofollow" title="Packages compatible with Dart SDK">Dart</a><a class="tag-badge-sub" href="/packages?q=sdk%3Aflutter" rel="nofollow" title="Packages compatible with Flutter SDK">Flutter</a></div><div class="-pub-tag-badge"><span class="tag-badge-main">Platform</span><a class="tag-badge-sub" href="/packages?q=platform%3Aandroid" rel="nofollow" title="Packages compatible with Android platform">Android</a><a class="tag-badge-sub" href="/packages?q=platform%3Aios" rel="nofollow" title="Packages compatible with iOS platform">iOS</a><a class="tag-badge-sub" href="/packages?q=platform%3Alinux" rel="nofollow" title="Packages compatible with Linux platform">Linux</a><a class="tag-badge-sub" href="/packages?q=platform%3Amacos" rel="nofollow" title="Packages compatible with macOS platform">macOS</a><a class="tag-badge-sub" href="/packages?q=platform%3Aweb" rel="nofollow" title="Packages compatible with Web platform">web</a><a class="tag-badge-sub" href="/packages?q=platform%3Awindows" rel="nofollow" title="Packages compatible with Windows platform">Windows</a></div></div><div class="detail-like"><button id="-pub-like-icon-button" class="mdc-icon-button" data-ga-click-event="toggle-like" aria-pressed="false" title="Like this package"><img class="mdc-icon-button__icon" src="/static/hash-o6oemknr/img/like-inactive.svg" alt="liked status: inactive" width="18" height="18"/><img class="mdc-icon-button__icon mdc-icon-button__icon--on" src="/static/hash-o6oemknr/img/like-active.svg" alt="liked status: active" width="18" height="18"/></button><span class="likes-count"><span id="likes-count">5.5k</span></span></div></div></div></div></div></div><div class="detail-container"><div class="detail-lead"><div class="detail-metadata-toggle"><div class="detail-metadata-toggle-icon">→</div><h3 class="detail-lead-title">Metadata</h3></div><p class="detail-lead-text">Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.</p><p class="detail-lead-more"><a class="detail-metadata-toggle">More...</a></p></div></div><div class="detail-body"><div class="detail-tabs"><div class="detail-tabs-wide-header"><div class="detail-container"><ul class="detail-tabs-header"><li class="detail-tab tab-button detail-tab-readme-title -active">Readme</li><li class="detail-tab tab-link detail-tab-changelog-title"><a href="/packages/intl/changelog" role="button">Changelog</a></li><li class="detail-tab tab-link detail-tab-installing-title"><a href="/packages/intl/install" role="button">Installing</a></li><li class="detail-tab tab-link detail-tab-versions-title"><a href="/packages/intl/versions" role="button">Versions</a></li><li class="detail-tab tab-link detail-tab-analysis-title"><a href="/packages/intl/score" role="button">Scores</a></li></ul></div></div><div class="detail-container detail-body-main"><div class="detail-tabs-content"><section class="tab-content detail-tab-readme-content -active markdown-body"><p><a href="https://github.com/dart-lang/i18n/actions/workflows/intl.yml" rel="ugc"><img src="https://github.com/dart-lang/i18n/actions/workflows/intl.yml/badge.svg" alt="Dart CI"></a> <a href="https://pub.dev/packages/intl"><img src="https://img.shields.io/pub/v/intl.svg" alt="Pub"></a></p> <p>Provides internationalization and localization facilities, including message translation, plurals and genders, date/number formatting and parsing, and bidirectional text.</p> <h2 class="hash-header" id="general">General <a href="#general" class="hash-link">#</a></h2> <p>The most important library is <a href="https://pub.dev/documentation/intl/latest/intl/intl-library.html">intl</a>. It defines the <a href="https://pub.dev/documentation/intl/latest/intl/Intl-class.html">Intl</a> class, with the default locale and methods for accessing most of the internationalization mechanisms. This library also defines the <a href="https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html">DateFormat</a>, <a href="https://pub.dev/documentation/intl/latest/intl/NumberFormat-class.html">NumberFormat</a>, and <a href="https://pub.dev/documentation/intl/latest/intl/BidiFormatter-class.html">BidiFormatter</a> classes.</p> <h2 class="hash-header" id="current-locale">Current locale <a href="#current-locale" class="hash-link">#</a></h2> <p>The package has a single current locale, called <a href="https://pub.dev/documentation/intl/latest/intl/Intl/defaultLocale.html">defaultLocale</a>. Operations will use that locale unless told to do otherwise.</p> <p>You can explicitly set the global locale</p> <pre><code class="language-dart">Intl.defaultLocale = 'pt_BR'; </code></pre> <p>or get it from the browser</p> <pre><code class="language-dart">import 'package:intl/intl_browser.dart'; ... findSystemLocale().then(runTheRestOfMyProgram); </code></pre> <p>To override the current locale for a particular operation, pass the operation to <a href="https://pub.dev/documentation/intl/latest/intl/Intl/withLocale.html">withLocale</a>. Note that this includes async tasks spawned from that operation, and that the argument to <a href="https://pub.dev/documentation/intl/latest/intl/Intl/withLocale.html">withLocale</a> will supercede the <a href="https://pub.dev/documentation/intl/latest/intl/Intl/defaultLocale.html">defaultLocale</a> while the operation is active. If you are using different locales within an application, the <a href="https://pub.dev/documentation/intl/latest/intl/Intl/withLocale.html">withLocale</a> operation may be preferable to setting <a href="https://pub.dev/documentation/intl/latest/intl/Intl/defaultLocale.html">defaultLocale</a>.</p> <pre><code class="language-dart">Intl.withLocale('fr', () => print(myLocalizedMessage())); </code></pre> <p>To specify the locale for an operation you can create a format object in a specific locale, pass in the locale as a parameter to methods, or set the default locale.</p> <pre><code class="language-dart">var format = DateFormat.yMd('ar'); var dateString = format.format(DateTime.now()); </code></pre> <p>or</p> <pre><code class="language-dart">print(myMessage(dateString, locale: 'ar'); </code></pre> <p>or</p> <pre><code class="language-dart">Intl.defaultLocale = 'es'; DateFormat.jm().format(DateTime.now()); </code></pre> <h2 class="hash-header" id="initialization">Initialization <a href="#initialization" class="hash-link">#</a></h2> <p>All the different types of locale data require an async initialization step to make sure the data is available. This reduces the size of the application by only loading the data that is actually required.</p> <p>Each different area of internationalization (messages, dates, numbers) requires a separate initialization process. That way, if the application only needs to format dates, it doesn't need to take the time or space to load up messages, numbers, or other things it may not need.</p> <p>With messages, there is also a need to import a file that won't exist until the code generation step has been run. This can be awkward, but can be worked around by creating a stub <code>messages_all.dart</code> file, running an empty translation step, or commenting out the import until translations are available. See "Extracting and Using Translated Messages"</p> <h2 class="hash-header" id="messages">Messages <a href="#messages" class="hash-link">#</a></h2> <p>Messages to be localized are written as functions that return the result of an <a href="https://pub.dev/documentation/intl/latest/intl/Intl/message.html">Intl.message</a> call.</p> <pre><code class="language-dart">String continueMessage() => Intl.message( 'Hit any key to continue', name: 'continueMessage', args: [], desc: 'Explains that we will not proceed further until ' 'the user presses a key'); print(continueMessage()); </code></pre> <p>This provides, in addition to the basic message string, a name, a description for translators, the arguments used in the message, and examples. The <code>name</code> and <code>args</code> parameters must match the name (or ClassName_methodName) and arguments list of the function respectively. For messages without parameters, both of these can be omitted.</p> <p>A function with an Intl.message call can be run in the program before any translation has been done, and will just return the message string. It can also be extracted to a file and then be made to return a translated version without modifying the original program. See "Extracting Messages" below for more details.</p> <p>The purpose of wrapping the message in a function is to allow it to have parameters which can be used in the result. The message string is allowed to use a restricted form of Dart string interpolation, where only the function's parameters can be used, and only in simple expressions. Local variables cannot be used, and neither can expressions with curly braces. Only the message string can have interpolation. The name, desc, args, and examples must be literals and not contain interpolations. Only the args parameter can refer to variables, and it should list exactly the function parameters. If you are passing numbers or dates and you want them formatted, you must do the formatting outside the function and pass the formatted string into the message.</p> <pre><code class="language-dart">greetingMessage(name) => Intl.message( 'Hello $name!', name: 'greetingMessage', args: [name], desc: 'Greet the user as they first open the application', examples: const {'name': 'Emily'}); print(greetingMessage('Dan')); </code></pre> <p>There is one special class of complex expressions allowed in the message string, for plurals and genders.</p> <pre><code class="language-dart">remainingEmailsMessage(int howMany, String userName) => Intl.message( '''${Intl.plural(howMany, zero: 'There are no emails left for $userName.', one: 'There is $howMany email left for $userName.', other: 'There are $howMany emails left for $userName.')}''', name: 'remainingEmailsMessage', args: [howMany, userName], desc: 'How many emails remain after archiving.', examples: const {'howMany': 42, 'userName': 'Fred'}); print(remainingEmailsMessage(1, 'Fred')); </code></pre> <p>However, since the typical usage for a plural or gender is for it to be at the top-level, we can also omit the <a href="https://pub.dev/documentation/intl/latest/intl/Intl/message.html">Intl.message</a> call and provide its parameters to the <a href="https://pub.dev/documentation/intl/latest/intl/Intl/plural.html">Intl.plural</a> call instead.</p> <pre><code class="language-dart">remainingEmailsMessage(int howMany, String userName) => Intl.plural( howMany, zero: 'There are no emails left for $userName.', one: 'There is $howMany email left for $userName.', other: 'There are $howMany emails left for $userName.', name: 'remainingEmailsMessage', args: [howMany, userName], desc: 'How many emails remain after archiving.', examples: const {'howMany': 42, 'userName': 'Fred'}); </code></pre> <p>Similarly, there is an <a href="https://pub.dev/documentation/intl/latest/intl/Intl/gender.html">Intl.gender</a> message, and plurals and genders can be nested.</p> <pre><code class="language-dart">notOnlineMessage(String userName, String userGender) => Intl.gender( userGender, male: '$userName is unavailable because he is not online.', female: '$userName is unavailable because she is not online.', other: '$userName is unavailable because they are not online', name: 'notOnlineMessage', args: [userName, userGender], desc: 'The user is not available to hangout.', examples: const {{'userGender': 'male', 'userName': 'Fred'}, {'userGender': 'female', 'userName' : 'Alice'}}); </code></pre> <p>It's recommended to use complete sentences in the sub-messages to keep the structure as simple as possible for the translators.</p> <h2 class="hash-header" id="extracting-and-using-translated-messages">Extracting And Using Translated Messages <a href="#extracting-and-using-translated-messages" class="hash-link">#</a></h2> <p>When your program contains messages that need translation, these must be extracted from the program source, sent to human translators, and the results need to be incorporated. The code for this is in the <a href="https://pub.dev/packages/intl_translation">Intl_translation</a> package.</p> <p>To extract messages, run the <code>extract_to_arb.dart</code> program.</p> <pre><code class="language-console">> pub run intl_translation:extract_to_arb --output-dir=target/directory my_program.dart more_of_my_program.dart </code></pre> <p>This will produce a file <code>intl_messages.arb</code> with the messages from all of these programs. See <a href="https://github.com/google/app-resource-bundle" rel="ugc">ARB</a>. The resulting translations can be used to generate a set of libraries using the <code>generate_from_arb.dart</code> program.</p> <p>This expects to receive a series of files, one per locale.</p> <pre><code class="language-console">> pub run intl_translation:generate_from_arb --generated_file_prefix=<prefix> <my_dart_files> <translated_ARB_files> </code></pre> <p>This will generate Dart libraries, one per locale, which contain the translated versions. Your Dart libraries can import the primary file, named <code><prefix>messages_all.dart</code>, and then call the initialization for a specific locale. Once that's done, any <a href="https://pub.dev/documentation/intl/latest/intl/Intl/message.html">Intl.message</a> calls made in the context of that locale will automatically print the translated version instead of the original.</p> <pre><code class="language-dart">import 'my_prefix_messages_all.dart'; ... initializeMessages('dk').then(printSomeMessages); </code></pre> <p>Once the future returned from the initialization call returns, the message data is available.</p> <h2 class="hash-header" id="number-formatting-and-parsing">Number Formatting and Parsing <a href="#number-formatting-and-parsing" class="hash-link">#</a></h2> <p>To format a number, create a NumberFormat instance.</p> <pre><code class="language-dart">var f = NumberFormat('###.0#', 'en_US'); print(f.format(12.345)); ==> 12.35 </code></pre> <p>The locale parameter is optional. If omitted, then it will use the current locale. The format string is as described in <a href="https://pub.dev/documentation/intl/latest/intl/NumberFormat-class.html">NumberFormat</a></p> <p>It's also possible to access the number symbol data for the current locale, which provides information as to the various separator characters, patterns, and other information used for formatting, as</p> <pre><code class="language-dart">f.symbols </code></pre> <p>Current known limitations are that the currency format will only print the name of the currency, and does not support currency symbols, and that the scientific format does not really agree with scientific notation. Number parsing is not yet implemented.</p> <h2 class="hash-header" id="date-formatting-and-parsing">Date Formatting and Parsing <a href="#date-formatting-and-parsing" class="hash-link">#</a></h2> <p>To format a <a href="https://api.dart.dev/dart-core/DateTime-class.html">DateTime</a>, create a <a href="https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html">DateFormat</a> instance. These can be created using a set of commonly used skeletons taken from ICU/CLDR or using an explicit pattern. For details on the supported skeletons and patterns see <a href="https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html">DateFormat</a>.</p> <pre><code class="language-dart">DateFormat.yMMMMEEEEd().format(aDateTime); ==> 'Wednesday, January 10, 2012' DateFormat('EEEEE', 'en_US').format(aDateTime); ==> 'Wednesday' DateFormat('EEEEE', 'ln').format(aDateTime); ==> 'mokɔlɔ mwa mísáto' </code></pre> <p>You can also parse dates using the same skeletons or patterns.</p> <pre><code class="language-dart">DateFormat.yMd('en_US').parse('1/10/2012'); DateFormat('Hms', 'en_US').parse('14:23:01'); </code></pre> <p>Skeletons can be combined, the main use being to print a full date and time, e.g.</p> <pre><code class="language-dart">DateFormat.yMEd().add_jms().format(DateTime.now()); ==> 'Thu, 5/23/2013 10:21:47 AM' </code></pre> <p>Known limitations: Time zones are not yet supported. Dart <a href="https://api.dart.dev/dart-core/DateTime-class.html">DateTime</a> objects don't have a time zone, so are either local or UTC. Formatting and parsing Durations is not yet implemented.</p> <p>Note that before doing any DateTime formatting for a particular locale, you must load the appropriate data by calling.</p> <pre><code class="language-dart">import 'package:intl/date_symbol_data_local.dart'; ... initializeDateFormatting('de_DE', null).then(formatDates); </code></pre> <p>Once the future returned from the initialization call returns, the formatting data is available.</p> <p>There are other mechanisms for loading the date formatting data implemented, but we expect to deprecate those in favor of having the data in a library as in the above, and using deferred loading to only load the portions that are needed. For the time being, this will include all of the data, which will increase code size.</p> <h2 class="hash-header" id="bidirectional-text">Bidirectional Text <a href="#bidirectional-text" class="hash-link">#</a></h2> <p>The class <a href="https://pub.dev/documentation/intl/latest/intl/BidiFormatter-class.html">BidiFormatter</a> provides utilities for working with Bidirectional text. We can wrap the string with unicode directional indicator characters or with an HTML span to indicate direction. The direction can be specified with the <a href="https://pub.dev/documentation/intl/latest/intl/BidiFormatter/BidiFormatter.RTL.html">RTL</a> and <a href="https://pub.dev/documentation/intl/latest/intl/BidiFormatter/BidiFormatter.LTR.html">LTR</a> constructors, or detected from the text.</p> <pre><code class="language-dart">BidiFormatter.RTL().wrapWithUnicode('xyz'); BidiFormatter.RTL().wrapWithSpan('xyz'); </code></pre> </section></div></div></div><aside class="detail-info-box"><a class="packages-scores" href="/packages/intl/score"><div class="packages-score packages-score-like"><div class="packages-score-value -has-value"><span class="packages-score-value-number">5575</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">likes</div></div><div class="packages-score packages-score-health"><div class="packages-score-value -has-value"><span class="packages-score-value-number">140</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">pub points</div></div><div class="packages-score packages-score-popularity"><div class="packages-score-value -has-value"><span class="packages-score-value-number">100</span><span class="packages-score-value-sign">%</span></div><div class="packages-score-label">popularity</div></div></a><h3 class="title">Publisher</h3><p><a href="/publishers/dart.dev"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-o6oemknr/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>dart.dev</a></p><h3 class="title pkg-infobox-metadata">Metadata</h3><p>Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.</p><p><a class="link" href="https://github.com/dart-lang/i18n/tree/main/pkgs/intl" rel="ugc">Repository (GitHub)</a><br/><a class="link" href="https://github.com/dart-lang/i18n/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aintl" rel="ugc">View/report issues</a><br/><a class="link" href="https://github.com/dart-lang/i18n/blob/main/CONTRIBUTING.md" rel="ugc">Contributing</a><br/></p><h3 class="title">Topics</h3><p><a href="/packages?q=topic%3Ai18n" rel="nofollow" title="Packages that facilitate internationalization.">#i18n</a> <a href="/packages?q=topic%3Aintl" rel="nofollow">#intl</a></p><h3 class="title">Documentation</h3><p><a class="link" href="/documentation/intl/latest/">API reference</a><br/></p><h3 class="title">License</h3><p><img class="inline-icon-img filter-invert-on-dark" src="/static/hash-o6oemknr/img/material-icon-balance.svg" alt="" width="14" height="14" role="presentation"/>BSD-3-Clause (<a href="/packages/intl/license">license</a>)</p><h3 class="title">Dependencies</h3><p><a href="/packages/clock" title="^1.1.0">clock</a>, <a href="/packages/http" title="^1.0.0">http</a>, <a href="/packages/meta" title="^1.0.2">meta</a>, <a href="/packages/path" title="^1.8.0">path</a>, <a href="/packages/web" title="^0.5.0">web</a></p><h3 class="title">More</h3><p><a href="/packages?q=dependency%3Aintl" rel="nofollow">Packages that depend on intl</a></p></aside></div><script type="application/ld+json">{"@context":"http\u003a\u002f\u002fschema.org","@type":"SoftwareSourceCode","name":"intl","version":"0.20.0","description":"intl - Contains code to deal with internationalized\u002flocalized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.","url":"https\u003a\u002f\u002fpub.dev\u002fpackages\u002fintl","dateCreated":"2012-11-30T21\u003a19\u003a19.569Z","dateModified":"2024-11-13T08\u003a01\u003a28.889479Z","programmingLanguage":"Dart","image":"https\u003a\u002f\u002fpub.dev\u002fstatic\u002fimg\u002fpub-dev-icon-cover-image.png","license":"https\u003a\u002f\u002fpub.dev\u002fpackages\u002fintl\u002flicense"}</script></div><div class="detail-metadata"><h3 class="detail-metadata-title"><span class="detail-metadata-toggle">←</span> Metadata</h3><div class="detail-info-box"><a class="packages-scores" href="/packages/intl/score"><div class="packages-score packages-score-like"><div class="packages-score-value -has-value"><span class="packages-score-value-number">5575</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">likes</div></div><div class="packages-score packages-score-health"><div class="packages-score-value -has-value"><span class="packages-score-value-number">140</span><span class="packages-score-value-sign"></span></div><div class="packages-score-label">pub points</div></div><div class="packages-score packages-score-popularity"><div class="packages-score-value -has-value"><span class="packages-score-value-number">100</span><span class="packages-score-value-sign">%</span></div><div class="packages-score-label">popularity</div></div></a><h3 class="title">Publisher</h3><p><a href="/publishers/dart.dev"><img class="-pub-publisher-shield filter-invert-on-dark" src="/static/hash-o6oemknr/img/material-icon-verified.svg" alt="verified publisher" width="14" height="14" title="Published by a pub.dev verified publisher"/>dart.dev</a></p><h3 class="title pkg-infobox-metadata">Metadata</h3><p>Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.</p><p><a class="link" href="https://github.com/dart-lang/i18n/tree/main/pkgs/intl" rel="ugc">Repository (GitHub)</a><br/><a class="link" href="https://github.com/dart-lang/i18n/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aintl" rel="ugc">View/report issues</a><br/><a class="link" href="https://github.com/dart-lang/i18n/blob/main/CONTRIBUTING.md" rel="ugc">Contributing</a><br/></p><h3 class="title">Topics</h3><p><a href="/packages?q=topic%3Ai18n" rel="nofollow" title="Packages that facilitate internationalization.">#i18n</a> <a href="/packages?q=topic%3Aintl" rel="nofollow">#intl</a></p><h3 class="title">Documentation</h3><p><a class="link" href="/documentation/intl/latest/">API reference</a><br/></p><h3 class="title">License</h3><p><img class="inline-icon-img filter-invert-on-dark" src="/static/hash-o6oemknr/img/material-icon-balance.svg" alt="" width="14" height="14" role="presentation"/>BSD-3-Clause (<a href="/packages/intl/license">license</a>)</p><h3 class="title">Dependencies</h3><p><a href="/packages/clock" title="^1.1.0">clock</a>, <a href="/packages/http" title="^1.0.0">http</a>, <a href="/packages/meta" title="^1.0.2">meta</a>, <a href="/packages/path" title="^1.8.0">path</a>, <a href="/packages/web" title="^0.5.0">web</a></p><h3 class="title">More</h3><p><a href="/packages?q=dependency%3Aintl" rel="nofollow">Packages that depend on intl</a></p></div><p class="detail-lead-back"><a class="detail-metadata-toggle">Back</a></p></div><div id="-screenshot-carousel" class="carousel"><fab id="-carousel-prev" class="mdc-fab carousel-prev carousel-nav" data-mdc-auto-init="MDCRipple" title="Previous" data-ga-click-event="screenshot-carousel-prev-click" tabindex="0"><div class="mdc-fab__ripple"></div><img class="mdc-fab__icon" src="/static/hash-o6oemknr/img/keyboard_arrow_left.svg" alt="previous" width="24" height="24" aria-hidden="true"/></fab><div id="-image-container" class="image-container"></div><fab id="-carousel-next" class="mdc-fab carousel-next carousel-nav" data-mdc-auto-init="MDCRipple" title="Next" data-ga-click-event="screenshot-carousel-next-click" tabindex="0"><div class="mdc-fab__ripple"></div><img class="mdc-fab__icon" src="/static/hash-o6oemknr/img/keyboard_arrow_right.svg" alt="next" width="24" height="24" aria-hidden="true"/></fab><p id="-screenshot-description" class="screenshot-description"></p></div></main><footer class="site-footer"><a class="link" href="https://dart.dev/">Dart language</a><a class="link sep" href="/report?subject=package%3Aintl&url=https%3A%2F%2Fpub.dev%2Fpackages%2Fintl">Report package</a><a class="link sep" href="/policy">Policy</a><a class="link sep" href="https://www.google.com/intl/en/policies/terms/">Terms</a><a class="link sep" href="https://developers.google.com/terms/">API Terms</a><a class="link sep" href="/security">Security</a><a class="link sep" href="https://www.google.com/intl/en/policies/privacy/">Privacy</a><a class="link sep" href="/help">Help</a><a class="link icon sep" href="/feed.atom"><img class="inline-icon" src="/static/hash-o6oemknr/img/rss-feed-icon.svg" alt="RSS" width="20" height="20" title="RSS/atom feed"/></a><a class="link icon github_issue" href="https://github.com/dart-lang/pub-dev/issues/new"><img class="inline-icon" src="/static/hash-o6oemknr/img/bug-report-white-96px.png" alt="bug report" width="20" height="20" title="Report an issue with this site"/></a></footer><script src="/static/hash-o6oemknr/highlight/highlight-with-init.js" defer="defer"></script></body></html>