Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
f16a569e
Unverified
Commit
f16a569e
authored
Nov 11, 2018
by
Gary Qian
Committed by
GitHub
Nov 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Supported locales docs to explain proper scriptCode usage. (#24184)
parent
58397108
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
app.dart
packages/flutter/lib/src/widgets/app.dart
+28
-0
No files found.
packages/flutter/lib/src/widgets/app.dart
View file @
f16a569e
...
...
@@ -560,6 +560,34 @@ class WidgetsApp extends StatefulWidget {
/// [supportedLocales] with a matching [Locale.languageCode] is used. If that
/// fails then the first locale in [supportedLocales] is used. The default
/// locale resolution algorithm can be overridden with [localeResolutionCallback].
///
/// When supporting languages with more than one script, it is recommended
/// to specify the [Locale.scriptCode] explicitly. Locales may also be defined without
/// [Locale.countryCode] to specify a generic fallback for a particular script.
///
/// A fully supported language with multiple scripts should define a generic language-only
/// locale (eg. 'zh'), language+script only locales (eg. 'zh_Hans' and 'zh_Hant'),
/// and any language+script+country locales (eg. 'zh_Hans_CN'). Fully defining all of
/// these locales as supported is not strictly required but allows for proper locale resolution in
/// the most number of cases. These locales can be specified with the [Locale.fromSubtags]
/// constructor:
///
/// ```dart
/// // Full Chinese support for CN, TW, and HK
/// supportedLocales: [
/// const Locale.fromSubtags(languageCode: 'zh'), // generic Chinese 'zh'
/// const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans'), // generic simplified Chinese 'zh_Hans'
/// const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'), // generic traditional Chinese 'zh_Hant'
/// const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hans', countryCode: 'CN'), // 'zh_Hans_CN'
/// const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: 'TW'), // 'zh_Hant_TW'
/// const Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant', countryCode: 'HK'), // 'zh_Hant_HK'
/// ],
/// ```
///
/// Omitting some these fallbacks may result in improperly resolved
/// edge-cases, for example, a simplified Chinese user in Taiwan ('zh_Hans_TW')
/// may resolve to traditional Chinese if 'zh_Hans' and 'zh_Hans_CN' are
/// omitted.
/// {@endtemplate}
///
/// See also:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment