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
f3fe8757
Commit
f3fe8757
authored
Sep 01, 2017
by
Hans Muller
Committed by
GitHub
Sep 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing Localizations API doc (#11896)
parent
7b33efb6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
4 deletions
+33
-4
gen_localizations.dart
dev/tools/gen_localizations.dart
+6
-1
localizations.dart
packages/flutter/lib/src/material/i18n/localizations.dart
+4
-0
material_localizations.dart
...ages/flutter/lib/src/material/material_localizations.dart
+3
-0
localizations.dart
packages/flutter/lib/src/widgets/localizations.dart
+20
-3
No files found.
dev/tools/gen_localizations.dart
View file @
f3fe8757
...
...
@@ -68,7 +68,12 @@ String generateString(String s) {
String
generateLocalizationsMap
(
)
{
final
StringBuffer
output
=
new
StringBuffer
();
output
.
writeln
(
'const Map<String, Map<String, String>> localizations = const <String, Map<String, String>> {'
);
output
.
writeln
(
'''
/// Maps from [Locale.languageCode] to a map that contains the localized strings
/// for that locale.
///
/// This variable is used by [MaterialLocalizations].
const Map<String, Map<String, String>> localizations = const <String, Map<String, String>> {'''
);
final
String
lastLocale
=
localeToResources
.
keys
.
last
;
for
(
String
locale
in
localeToResources
.
keys
)
{
...
...
packages/flutter/lib/src/material/i18n/localizations.dart
View file @
f3fe8757
...
...
@@ -6,6 +6,10 @@
// To regenerate the file, use:
// dart gen_localizations packages/flutter/lib/src/material/i18n material
/// Maps from [Locale.languageCode] to a map that contains the localized strings
/// for that locale.
///
/// This variable is used by [MaterialLocalizations].
const
Map
<
String
,
Map
<
String
,
String
>>
localizations
=
const
<
String
,
Map
<
String
,
String
>>
{
"ar"
:
const
<
String
,
String
>{
"openAppDrawerTooltip"
:
r"افتح قائمة التنقل"
,
...
...
packages/flutter/lib/src/material/material_localizations.dart
View file @
f3fe8757
...
...
@@ -52,6 +52,9 @@ abstract class MaterialLocalizations {
class
DefaultMaterialLocalizations
implements
MaterialLocalizations
{
/// Construct an object that defines the material widgets' localized strings
/// for the given `locale`.
///
/// [LocalizationsDelegate] implementations typically call the static [load]
/// function, rather than constructing this class directly.
DefaultMaterialLocalizations
(
this
.
locale
)
{
assert
(
locale
!=
null
);
_nameToValue
=
localizations
[
locale
.
toString
()]
...
...
packages/flutter/lib/src/widgets/localizations.dart
View file @
f3fe8757
...
...
@@ -78,9 +78,10 @@ Future<Map<Type, dynamic>> _loadAll(Locale locale, Iterable<LocalizationsDelegat
/// A factory for a set of localized resources of type `T`, to be loaded by a
/// [Localizations] widget.
///
/// Typical applications have one [Localizations] widget which is
/// created by the [WidgetsApp] and configured with the app's
/// `localizationsDelegates` parameter.
/// Typical applications have one [Localizations] widget which is created by the
/// [WidgetsApp] and configured with the app's `localizationsDelegates`
/// parameter (a list of delegates). The delegate's [type] is used to identify
/// the object created by an individual delegate's [load] method.
abstract
class
LocalizationsDelegate
<
T
>
{
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
...
...
@@ -102,6 +103,17 @@ abstract class LocalizationsDelegate<T> {
/// after [load] has completed.
bool
shouldReload
(
covariant
LocalizationsDelegate
<
T
>
old
);
/// The type of the object returned by the [load] method, T by default.
///
/// This type is used to retrieve the object "loaded" by this
/// [LocalizationsDelegate] from the [Localizations] inherited widget.
/// For example the object loaded by `LocalizationsDelegate<Foo>` would
/// be retrieved with:
/// ```dart
/// Foo foo = Localizations.of<Foo>(context, Foo);
/// ```
///
/// It's rarely necessary to override this getter.
Type
get
type
=>
T
;
@override
...
...
@@ -141,6 +153,11 @@ abstract class WidgetsLocalizations {
/// Localized values for widgets.
class
DefaultWidgetsLocalizations
implements
WidgetsLocalizations
{
/// Construct an object that defines the localized values for the widgets
/// library for the given `locale`.
///
/// [LocalizationsDelegate] implementations typically call the static [load]
/// function, rather than constructing this class directly.
DefaultWidgetsLocalizations
(
this
.
locale
)
{
final
String
language
=
locale
.
languageCode
.
toLowerCase
();
_textDirection
=
_rtlLanguages
.
contains
(
language
)
?
TextDirection
.
rtl
:
TextDirection
.
ltr
;
...
...
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