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
0e735e4b
Unverified
Commit
0e735e4b
authored
Jul 01, 2020
by
Gary Qian
Committed by
GitHub
Jul 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose ComputePlatformResolvedLocale (#58482)
parent
e8670de0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
binding.dart
packages/flutter/lib/src/widgets/binding.dart
+40
-0
No files found.
packages/flutter/lib/src/widgets/binding.dart
View file @
0e735e4b
...
...
@@ -944,6 +944,46 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
buildOwner
.
reassemble
(
renderViewElement
);
return
super
.
performReassemble
();
}
/// Computes the locale the current platform would resolve to.
///
/// This method is meant to be used as part of a [localeListResolutionCallback].
/// Since this method may return null, a Flutter/dart algorithm should still be
/// provided as a fallback in case a native resolved locale cannot be determined
/// or if the native resolved locale is undesirable.
///
/// This method may return a null [Locale] if the platform does not support
/// native locale resolution, or if the resolution failed.
///
/// The first [supportedLocale] is treated as the default locale and will be returned
/// if no better match is found.
///
/// Android and iOS are currently supported.
///
/// On Android, the algorithm described in
/// https://developer.android.com/guide/topics/resources/multilingual-support
/// is used to determine the resolved locale. Depending on the android version
/// of the device, either the modern (>= API 24) or legacy (< API 24) algorithm
/// will be used.
///
/// On iOS, the result of `preferredLocalizationsFromArray` method of `NSBundle`
/// is returned. See:
/// https://developer.apple.com/documentation/foundation/nsbundle/1417249-preferredlocalizationsfromarray?language=objc
/// for details on the used method.
///
/// iOS treats script code as necessary for a match, so a user preferred locale of
/// `zh_Hans_CN` will not resolve to a supported locale of `zh_CN`.
///
/// Since implementation may vary by platform and has potential to be heavy,
/// it is recommended to cache the results of this method if the value is
/// used multiple times.
///
/// Second-best (and n-best) matching locales should be obtained by calling this
/// method again with the matched locale of the first call omitted from
/// [supportedLocales].
Locale
computePlatformResolvedLocale
(
List
<
Locale
>
supportedLocales
)
{
return
window
.
computePlatformResolvedLocale
(
supportedLocales
);
}
}
/// Inflate the given widget and attach it to the screen.
...
...
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