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
96a70e89
Commit
96a70e89
authored
Sep 12, 2017
by
Hans Muller
Committed by
GitHub
Sep 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Localizations (#12021)
parent
3e21c070
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
468 additions
and
32 deletions
+468
-32
localizations.dart
packages/flutter/lib/src/material/i18n/localizations.dart
+113
-0
material_ar.arb
packages/flutter/lib/src/material/i18n/material_ar.arb
+7
-0
material_de.arb
packages/flutter/lib/src/material/i18n/material_de.arb
+10
-0
material_en.arb
packages/flutter/lib/src/material/i18n/material_en.arb
+39
-0
material_es.arb
packages/flutter/lib/src/material/i18n/material_es.arb
+9
-0
material_fa.arb
packages/flutter/lib/src/material/i18n/material_fa.arb
+7
-0
material_fr.arb
packages/flutter/lib/src/material/i18n/material_fr.arb
+9
-0
material_he.arb
packages/flutter/lib/src/material/i18n/material_he.arb
+7
-0
material_it.arb
packages/flutter/lib/src/material/i18n/material_it.arb
+7
-0
material_ja.arb
packages/flutter/lib/src/material/i18n/material_ja.arb
+7
-0
material_ps.arb
packages/flutter/lib/src/material/i18n/material_ps.arb
+8
-1
material_pt.arb
packages/flutter/lib/src/material/i18n/material_pt.arb
+7
-0
material_ru.arb
packages/flutter/lib/src/material/i18n/material_ru.arb
+7
-0
material_sd.arb
packages/flutter/lib/src/material/i18n/material_sd.arb
+7
-0
material_ur.arb
packages/flutter/lib/src/material/i18n/material_ur.arb
+7
-0
material_zh.arb
packages/flutter/lib/src/material/i18n/material_zh.arb
+7
-0
material_localizations.dart
...ages/flutter/lib/src/material/material_localizations.dart
+97
-17
paginated_data_table.dart
packages/flutter/lib/src/material/paginated_data_table.dart
+14
-8
popup_menu.dart
packages/flutter/lib/src/material/popup_menu.dart
+3
-2
app.dart
packages/flutter/lib/src/widgets/app.dart
+15
-0
localizations_test.dart
packages/flutter/test/material/localizations_test.dart
+81
-4
No files found.
packages/flutter/lib/src/material/i18n/localizations.dart
View file @
96a70e89
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/i18n/material_ar.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"إغلا"
,
"nextMonthTooltip"
:
"الشهر القادم"
,
"previousMonthTooltip"
:
"الشهر الماضى"
,
"nextPageTooltip"
:
"الصفحة التالية"
,
"previousPageTooltip"
:
"الصفحة السابقة"
,
"showMenuTooltip"
:
"قائمة العرض"
,
"licensesPageTitle"
:
"التّراخيص"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow أو $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow من حوالي $rowCount"
,
"rowsPerPageTitle"
:
"الصفوف في الصفحة:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount العناصر المحددة"
,
"cancelButtonLabel"
:
"إلغاء"
,
"closeButtonLabel"
:
"أغلاق"
,
"continueButtonLabel"
:
"استمر"
,
...
...
packages/flutter/lib/src/material/i18n/material_de.arb
View file @
96a70e89
...
...
@@ -4,7 +4,17 @@
"closeButtonTooltip"
:
"Schließen"
,
"nextMonthTooltip"
:
"Nächster Monat"
,
"previousMonthTooltip"
:
"Vorheriger Monat"
,
"nextPageTooltip"
:
"Nächste Seite"
,
"previousPageTooltip"
:
"Vorherige Seite"
,
"showMenuTooltip"
:
"Menü anzeigen"
,
"licensesPageTitle"
:
"Lizenzen"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow von $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow von etwa $rowCount"
,
"rowsPerPageTitle"
:
"Zeilen pro Seite:"
,
"selectedRowCountTitleZero"
:
"Keine Objekte ausgewählt"
,
"selectedRowCountTitleOne"
:
"1 Objekt ausgewählt"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount Objekte ausgewählt"
,
"cancelButtonLabel"
:
"ABBRECHEN"
,
"closeButtonLabel"
:
"SCHLIESSEN"
,
"continueButtonLabel"
:
"FORTSETZEN"
,
...
...
packages/flutter/lib/src/material/i18n/material_en.arb
View file @
96a70e89
...
...
@@ -29,12 +29,51 @@
"type"
:
"text"
},
"nextPageTooltip"
:
"Next page"
,
"@nextMonthTooltip"
:
{
"description"
:
"The tooltip for the [PaginatedDataTables]'s 'next page' button."
,
"type"
:
"text"
},
"previousPageTooltip"
:
"Previous page"
,
"@previousMonthTooltip"
:
{
"description"
:
"The tooltip for the PaginatedDataTables's 'previous page' button."
,
"type"
:
"text"
},
"showMenuTooltip"
:
"Show menu"
,
"@showMenuTooltip"
:
{
"description"
:
"The default PopupMenuButton tooltip"
,
"type"
:
"text"
},
"licensesPageTitle"
:
"Licenses"
,
"@licensesPageTitle"
:
{
"description"
:
"The title for the Flutter licenses page."
,
"type"
:
"text"
},
"pageRowsInfoTitle"
:
"$firstRow–$lastRow of $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow of about $rowCount"
,
"@pageRowInfoTitle"
:
{
"description"
:
"Title for the [PaginatedDataTable]'s row info footer"
,
"type"
:
"text"
},
"rowsPerPageTitle"
:
"Rows per page:"
,
"@rowsPerPageTitle"
:
{
"description"
:
"Title for the [PaginatedDataTable]'s 'rows per page' footer."
,
"type"
:
"text"
},
"selectedRowCountTitleZero"
:
"No items selected"
,
"selectedRowCountTitleOne"
:
"1 item selected"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount items selected"
,
"@selectedRowCountTitle"
:
{
"description"
:
"Title for the PaginatedDataTable's selected row count header"
,
"type"
:
"text"
},
"cancelButtonLabel"
:
"CANCEL"
,
"@cancelButtonLabel"
:
{
"description"
:
"The label for cancel buttons and menu items."
,
...
...
packages/flutter/lib/src/material/i18n/material_es.arb
View file @
96a70e89
...
...
@@ -4,7 +4,16 @@
"closeButtonTooltip"
:
"Cerrar"
,
"nextMonthTooltip"
:
"Próximo mes"
,
"previousMonthTooltip"
:
"Mes anterior"
,
"nextPageTooltip"
:
"Siguiente página"
,
"previousPageTooltip"
:
"Pagina anterior"
,
"showMenuTooltip"
:
"Muestrame el menu"
,
"licensesPageTitle"
:
"Licencias"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow de $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow de aproximadamente $rowCount"
,
"rowsPerPageTitle"
:
"Filas por página:"
,
"selectedRowCountTitleZero"
:
"No se han seleccionado elementos"
,
"selectedRowCountTitleOne"
:
"1 artículo seleccionado"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount artículos seleccionados"
,
"cancelButtonLabel"
:
"CANCELAR"
,
"closeButtonLabel"
:
"CERRAR"
,
"continueButtonLabel"
:
"CONTINUAR"
,
...
...
packages/flutter/lib/src/material/i18n/material_fa.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"بستن"
,
"nextMonthTooltip"
:
"ماه بعد"
,
"previousMonthTooltip"
:
"ماه گذشته"
,
"nextPageTooltip"
:
"صفحه بعد"
,
"previousPageTooltip"
:
"صفحه قبلی"
,
"showMenuTooltip"
:
"نمایش منو"
,
"licensesPageTitle"
:
"مجوز"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow از $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow از حدود $rowCount"
,
"rowsPerPageTitle"
:
"ردیف در صفحه:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount آیتم های انتخاب شده"
,
"cancelButtonLabel"
:
"لغو"
,
"closeButtonLabel"
:
"بستن"
,
"continueButtonLabel"
:
"ادامه دهید"
,
...
...
packages/flutter/lib/src/material/i18n/material_fr.arb
View file @
96a70e89
...
...
@@ -4,7 +4,16 @@
"closeButtonTooltip"
:
"Fermer"
,
"nextMonthTooltip"
:
"Mois Suivant"
,
"previousMonthTooltip"
:
"Mois précédent"
,
"nextPageTooltip"
:
"Page suivante"
,
"previousPageTooltip"
:
"Page précédente"
,
"showMenuTooltip"
:
"Afficher le menu"
,
"licensesPageTitle"
:
"Licences"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow de $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow d'environ $rowCount"
,
"rowsPerPageTitle"
:
"Lignes par page:"
,
"selectedRowCountTitleZero"
:
"Aucun élément sélectionné"
,
"selectedRowCountTitleOne"
:
"1 élément sélectionné"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount éléments sélectionnés"
,
"cancelButtonLabel"
:
"ANNULER"
,
"closeButtonLabel"
:
"FERMER"
,
"continueButtonLabel"
:
"CONTINUER"
,
...
...
packages/flutter/lib/src/material/i18n/material_he.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"סגור"
,
"nextMonthTooltip"
:
"חודש הבא"
,
"previousMonthTooltip"
:
"חודש שעבר"
,
"nextPageTooltip"
:
"עמוד הבא"
,
"previousPageTooltip"
:
"עמוד קודם"
,
"showMenuTooltip"
:
"הצג תפריט"
,
"licensesPageTitle"
:
"רישיונות"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow מתוך $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow מתוך כ $rowCount"
,
"rowsPerPageTitle"
:
"שורות לעמוד:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount פריטים שנבחרו"
,
"cancelButtonLabel"
:
"ביטול"
,
"closeButtonLabel"
:
"סגור"
,
"continueButtonLabel"
:
"לְהַמשִׁיך"
,
...
...
packages/flutter/lib/src/material/i18n/material_it.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"Chiudi"
,
"nextMonthTooltip"
:
"Il prossimo mese"
,
"previousMonthTooltip"
:
"Il mese scorso"
,
"nextPageTooltip"
:
"Pagina successiva"
,
"previousPageTooltip"
:
"Pagina precedente"
,
"showMenuTooltip"
:
"Mostra il menu"
,
"licensesPageTitle"
:
"Licenze"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow di $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow di circa $rowCount"
,
"rowsPerPageTitle"
:
"Righe per pagina:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount selezionati"
,
"cancelButtonLabel"
:
"ANNULLA"
,
"closeButtonLabel"
:
"CHIUDI"
,
"continueButtonLabel"
:
"CONTINUA"
,
...
...
packages/flutter/lib/src/material/i18n/material_ja.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"閉じる"
,
"nextMonthTooltip"
:
"前の月へ"
,
"previousMonthTooltip"
:
"前の月へ"
,
"nextPageTooltip"
:
"次のページ"
,
"previousPageTooltip"
:
"前のページ"
,
"showMenuTooltip"
:
"メニューを表示"
,
"licensesPageTitle"
:
"ライセンス"
,
"pageRowsInfoTitle"
:
"$rowCount行中の$firstRow–$lastRow"
,
"pageRowsInfoTitleApproximate"
:
"約$rowCount行中の$firstRow–$lastRow"
,
"rowsPerPageTitle"
:
"1ページあたりの行数:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount個のアイテムが選択されています"
,
"cancelButtonLabel"
:
"キャンセル"
,
"closeButtonLabel"
:
"閉じる"
,
"continueButtonLabel"
:
"次へ"
,
...
...
packages/flutter/lib/src/material/i18n/material_ps.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"بنده"
,
"nextMonthTooltip"
:
"بله میاشت"
,
"previousMonthTooltip"
:
"تیره میاشت"
,
"nextPageTooltip"
:
"بله پاڼه"
,
"previousPageTooltip"
:
"مخکینی مخ"
,
"showMenuTooltip"
:
"غورنۍ ښودل"
,
"licensesPageTitle"
:
"جوازونه"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow د $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow څخه $rowCount د"
,
"rowsPerPageTitle"
:
"د هرې پاڼې پاڼې:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount توکي غوره شوي"
,
"cancelButtonLabel"
:
"لغوه کول"
,
"closeButtonLabel"
:
"تړل"
,
"continueButtonLabel"
:
"منځپانګې"
,
...
...
@@ -14,4 +21,4 @@
"pasteButtonLabel"
:
"پیټ کړئ"
,
"selectAllButtonLabel"
:
"غوره کړئ"
,
"viewLicensesButtonLabel"
:
"لیدلس وګورئ"
}
\ No newline at end of file
}
packages/flutter/lib/src/material/i18n/material_pt.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"Fechar"
,
"nextMonthTooltip"
:
"Próximo mês"
,
"previousMonthTooltip"
:
"Mês anterior"
,
"nextPageTooltip"
:
"Próxima página"
,
"previousPageTooltip"
:
"Página anterior"
,
"showMenuTooltip"
:
"Mostrar menu"
,
"licensesPageTitle"
:
"Licenças"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow de $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow de cerca de $rowCount"
,
"rowsPerPageTitle"
:
"Linhas por página:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount selecionados"
,
"cancelButtonLabel"
:
"CANCELAR"
,
"closeButtonLabel"
:
"FECHAR"
,
"continueButtonLabel"
:
"CONTINUAR"
,
...
...
packages/flutter/lib/src/material/i18n/material_ru.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"Закрыть"
,
"nextMonthTooltip"
:
"В следующем месяце"
,
"previousMonthTooltip"
:
"Предыдущий месяц"
,
"nextPageTooltip"
:
"Следущая страница"
,
"previousPageTooltip"
:
"Предыдущая страница"
,
"showMenuTooltip"
:
"Показать меню"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow из $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow около $rowCount"
,
"rowsPerPageTitle"
:
"Строки на страницу:"
,
"licensesPageTitle"
:
"Лицензии"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount выбранные предметы"
,
"cancelButtonLabel"
:
"ОТМЕНА"
,
"closeButtonLabel"
:
"ЗАКРЫТЬ"
,
"continueButtonLabel"
:
"ПРОДОЛЖАТЬ"
,
...
...
packages/flutter/lib/src/material/i18n/material_sd.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"بند ڪريو"
,
"nextMonthTooltip"
:
"ايندڙ مهيني"
,
"previousMonthTooltip"
:
"پويون مهينو"
,
"nextPageTooltip"
:
"اڳيون پيج"
,
"previousPageTooltip"
:
"پويون صفحو"
,
"showMenuTooltip"
:
"ڏيکاريو"
,
"licensesPageTitle"
:
"لائسنس"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow جي $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow کان $rowCount تقريبن"
,
"rowsPerPageTitle"
:
"رني پاسي وارو صفحو"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount شيون چونڊيل"
,
"cancelButtonLabel"
:
"منسوخ ڪيو"
,
"closeButtonLabel"
:
"بند ڪريو"
,
"continueButtonLabel"
:
"جاري رکو"
,
...
...
packages/flutter/lib/src/material/i18n/material_ur.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"بند کریں"
,
"nextMonthTooltip"
:
"اگلا مھینہ"
,
"previousMonthTooltip"
:
"پچھلا مھینہ"
,
"nextPageTooltip"
:
"اگلا صفحہ"
,
"previousPageTooltip"
:
"سابقہ صفحہ"
,
"showMenuTooltip"
:
"مینو دکھائیں"
,
"licensesPageTitle"
:
"لائسنس"
,
"pageRowsInfoTitle"
:
"$firstRow–$lastRow کے $rowCount"
,
"pageRowsInfoTitleApproximate"
:
"$firstRow–$lastRow میں سے $rowCount تقریبا"
,
"rowsPerPageTitle"
:
"رویوں فی صفحہ:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount منتخب کردہ اشیاء"
,
"cancelButtonLabel"
:
"منسوخ کریں"
,
"closeButtonLabel"
:
"بند کریں"
,
"continueButtonLabel"
:
"جاری رکھیں"
,
...
...
packages/flutter/lib/src/material/i18n/material_zh.arb
View file @
96a70e89
...
...
@@ -4,7 +4,14 @@
"closeButtonTooltip"
:
"关闭"
,
"nextMonthTooltip"
:
"下一个月"
,
"previousMonthTooltip"
:
"上一个月"
,
"nextPageTooltip"
:
"下一页"
,
"previousPageTooltip"
:
"上一页"
,
"showMenuTooltip"
:
"显示菜单"
,
"licensesPageTitle"
:
"许可证"
,
"pageRowsInfoTitle"
:
"$rowCount中的$firstRow-$lastRow"
,
"pageRowsInfoTitleApproximate"
:
"约$rowCount中的$firstRow-$lastRow"
,
"rowsPerPageTitle"
:
"每页行数:"
,
"selectedRowCountTitleOther"
:
"$selectedRowCount行所选"
,
"cancelButtonLabel"
:
"取消"
,
"continueButtonLabel"
:
"继续"
,
"closeButtonLabel"
:
"关闭"
,
...
...
packages/flutter/lib/src/material/material_localizations.dart
View file @
96a70e89
...
...
@@ -6,6 +6,7 @@ import 'dart:async';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:intl/intl.dart'
;
import
'i18n/localizations.dart'
;
...
...
@@ -16,7 +17,7 @@ import 'i18n/localizations.dart';
/// * [DefaultMaterialLocalizations], which implements this interface
/// and supports a variety of locales.
abstract
class
MaterialLocalizations
{
/// The tooltip for the leading [AppBar] menu (aka 'hamburger') button
/// The tooltip for the leading [AppBar] menu (aka 'hamburger') button
.
String
get
openAppDrawerTooltip
;
/// The [BackButton]'s tooltip.
...
...
@@ -31,9 +32,27 @@ abstract class MaterialLocalizations {
/// The tooltip for the [MonthPicker]'s "previous month" button.
String
get
previousMonthTooltip
;
/// The tooltip for the [PaginatedDataTables]'s "next page" button.
String
get
nextPageTooltip
;
/// The tooltip for the [PaginatedDataTables]'s "previous page" button.
String
get
previousPageTooltip
;
/// The default [PopupMenuButton] tooltip.
String
get
showMenuTooltip
;
/// Title for the [LicensePage] widget.
String
get
licensesPageTitle
;
/// Title for the [PaginatedDataTable]'s row info footer.
String
pageRowsInfoTitle
(
int
firstRow
,
int
lastRow
,
int
rowCount
,
bool
rowCountIsApproximate
);
/// Title for the [PaginatedDataTable]'s "rows per page" footer.
String
get
rowsPerPageTitle
;
/// Title for the PaginatedDataTable's selected row count header.
String
selectedRowCountTitle
(
int
selectedRowCount
);
/// Label for "cancel" buttons and menu items.
String
get
cancelButtonLabel
;
...
...
@@ -87,7 +106,7 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
/// function, rather than constructing this class directly.
DefaultMaterialLocalizations
(
this
.
locale
)
{
assert
(
locale
!=
null
);
_nameToValue
=
localizations
[
locale
.
toString
()
]
_nameToValue
=
localizations
[
_localeName
]
??
localizations
[
locale
.
languageCode
]
??
localizations
[
'en'
]
??
<
String
,
String
>{};
...
...
@@ -99,50 +118,111 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
/// have been translated.
final
Locale
locale
;
String
get
_localeName
{
final
String
localeName
=
locale
.
countryCode
.
isEmpty
?
locale
.
languageCode
:
locale
.
toString
();
return
Intl
.
canonicalizedLocale
(
localeName
);
}
// TODO(hmuller): the rules for mapping from an integer value to
// "one" or "two" etc. are locale specific and an additional "few" category
// is needed. See http://cldr.unicode.org/index/cldr-spec/plural-rules
String
_nameToPluralValue
(
int
count
,
String
key
)
{
String
text
;
if
(
count
==
0
)
text
=
_nameToValue
[
'
${key}
Zero'
];
else
if
(
count
==
1
)
text
=
_nameToValue
[
'
${key}
One'
];
else
if
(
count
==
2
)
text
=
_nameToValue
[
'
${key}
Two'
];
else
if
(
count
>
2
)
text
=
_nameToValue
[
'
${key}
Many'
];
text
??=
_nameToValue
[
'
${key}
Other'
];
assert
(
text
!=
null
);
return
text
;
}
String
_formatInteger
(
int
n
)
{
final
String
localeName
=
_localeName
;
if
(!
NumberFormat
.
localeExists
(
localeName
))
return
n
.
toString
();
return
new
NumberFormat
.
decimalPattern
(
localeName
).
format
(
n
);
}
@override
String
get
openAppDrawerTooltip
=>
_nameToValue
[
"openAppDrawerTooltip"
];
String
get
openAppDrawerTooltip
=>
_nameToValue
[
'openAppDrawerTooltip'
];
@override
String
get
backButtonTooltip
=>
_nameToValue
[
"backButtonTooltip"
];
String
get
backButtonTooltip
=>
_nameToValue
[
'backButtonTooltip'
];
@override
String
get
closeButtonTooltip
=>
_nameToValue
[
"closeButtonTooltip"
];
String
get
closeButtonTooltip
=>
_nameToValue
[
'closeButtonTooltip'
];
@override
String
get
nextMonthTooltip
=>
_nameToValue
[
"nextMonthTooltip"
];
String
get
nextMonthTooltip
=>
_nameToValue
[
'nextMonthTooltip'
];
@override
String
get
previousMonthTooltip
=>
_nameToValue
[
"previousMonthTooltip"
];
String
get
previousMonthTooltip
=>
_nameToValue
[
'previousMonthTooltip'
];
@override
String
get
licensesPageTitle
=>
_nameToValue
[
"licensesPageTitle"
];
String
get
nextPageTooltip
=>
_nameToValue
[
'nextPageTooltip'
];
@override
String
get
previousPageTooltip
=>
_nameToValue
[
'previousPageTooltip'
];
@override
String
get
showMenuTooltip
=>
_nameToValue
[
'showMenuTooltip'
];
@override
String
get
licensesPageTitle
=>
_nameToValue
[
'licensesPageTitle'
];
@override
String
pageRowsInfoTitle
(
int
firstRow
,
int
lastRow
,
int
rowCount
,
bool
rowCountIsApproximate
)
{
String
text
=
rowCountIsApproximate
?
_nameToValue
[
'pageRowsInfoTitleApproximate'
]
:
null
;
text
??=
_nameToValue
[
'pageRowsInfoTitle'
];
assert
(
text
!=
null
,
'A
$locale
localization was not found for pageRowsInfoTitle or pageRowsInfoTitleApproximate'
);
// TODO(hansmuller): this could be more efficient.
return
text
.
replaceFirst
(
r'$firstRow'
,
_formatInteger
(
firstRow
))
.
replaceFirst
(
r'$lastRow'
,
_formatInteger
(
lastRow
))
.
replaceFirst
(
r'$rowCount'
,
_formatInteger
(
rowCount
));
}
@override
String
get
rowsPerPageTitle
=>
_nameToValue
[
'rowsPerPageTitle'
];
@override
String
selectedRowCountTitle
(
int
selectedRowCount
)
{
return
_nameToPluralValue
(
selectedRowCount
,
'selectedRowCountTitle'
)
// asserts on no match
.
replaceFirst
(
r'$selectedRowCount'
,
_formatInteger
(
selectedRowCount
));
}
@override
String
get
cancelButtonLabel
=>
_nameToValue
[
"cancelButtonLabel"
];
String
get
cancelButtonLabel
=>
_nameToValue
[
'cancelButtonLabel'
];
@override
String
get
closeButtonLabel
=>
_nameToValue
[
"closeButtonLabel"
];
String
get
closeButtonLabel
=>
_nameToValue
[
'closeButtonLabel'
];
@override
String
get
continueButtonLabel
=>
_nameToValue
[
"continueButtonLabel"
];
String
get
continueButtonLabel
=>
_nameToValue
[
'continueButtonLabel'
];
@override
String
get
copyButtonLabel
=>
_nameToValue
[
"copyButtonLabel"
];
String
get
copyButtonLabel
=>
_nameToValue
[
'copyButtonLabel'
];
@override
String
get
cutButtonLabel
=>
_nameToValue
[
"cutButtonLabel"
];
String
get
cutButtonLabel
=>
_nameToValue
[
'cutButtonLabel'
];
@override
String
get
okButtonLabel
=>
_nameToValue
[
"okButtonLabel"
];
String
get
okButtonLabel
=>
_nameToValue
[
'okButtonLabel'
];
@override
String
get
pasteButtonLabel
=>
_nameToValue
[
"pasteButtonLabel"
];
String
get
pasteButtonLabel
=>
_nameToValue
[
'pasteButtonLabel'
];
@override
String
get
selectAllButtonLabel
=>
_nameToValue
[
"selectAllButtonLabel"
];
String
get
selectAllButtonLabel
=>
_nameToValue
[
'selectAllButtonLabel'
];
@override
String
get
viewLicensesButtonLabel
=>
_nameToValue
[
"viewLicensesButtonLabel"
];
String
get
viewLicensesButtonLabel
=>
_nameToValue
[
'viewLicensesButtonLabel'
];
/// Creates an object that provides localized resource values for the
/// for the widgets of the material library.
...
...
packages/flutter/lib/src/material/paginated_data_table.dart
View file @
96a70e89
...
...
@@ -16,6 +16,7 @@ import 'data_table_source.dart';
import
'dropdown.dart'
;
import
'icon_button.dart'
;
import
'icons.dart'
;
import
'material_localizations.dart'
;
import
'progress_indicator.dart'
;
import
'theme.dart'
;
...
...
@@ -286,6 +287,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
Widget
build
(
BuildContext
context
)
{
// TODO(ianh): This whole build function doesn't handle RTL yet.
final
ThemeData
themeData
=
Theme
.
of
(
context
);
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
// HEADER
final
List
<
Widget
>
headerWidgets
=
<
Widget
>[];
double
startPadding
=
24.0
;
...
...
@@ -300,11 +302,10 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
// TODO(ianh): Better magic. See https://github.com/flutter/flutter/issues/4460
startPadding
=
12.0
;
}
}
else
if
(
_selectedRowCount
==
1
)
{
// TODO(ianh): Real l10n.
headerWidgets
.
add
(
const
Expanded
(
child:
const
Text
(
'1 item selected'
)));
}
else
{
headerWidgets
.
add
(
new
Expanded
(
child:
new
Text
(
'
$_selectedRowCount
items selected'
)));
headerWidgets
.
add
(
new
Expanded
(
child:
new
Text
(
localizations
.
selectedRowCountTitle
(
_selectedRowCount
)),
));
}
if
(
widget
.
actions
!=
null
)
{
headerWidgets
.
addAll
(
...
...
@@ -332,7 +333,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
})
.
toList
();
footerWidgets
.
addAll
(<
Widget
>[
const
Text
(
'Rows per page:'
),
new
Text
(
localizations
.
rowsPerPageTitle
),
new
DropdownButtonHideUnderline
(
child:
new
DropdownButton
<
int
>(
items:
availableRowsPerPage
,
...
...
@@ -347,20 +348,25 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
footerWidgets
.
addAll
(<
Widget
>[
new
Container
(
width:
32.0
),
new
Text
(
'
${_firstRowIndex + 1}
\
u2013
${_firstRowIndex + widget.rowsPerPage}
${ _rowCountApproximate ? "of about" : "of" }
$_rowCount
'
localizations
.
pageRowsInfoTitle
(
_firstRowIndex
+
1
,
_firstRowIndex
+
widget
.
rowsPerPage
,
_rowCount
,
_rowCountApproximate
)
),
new
Container
(
width:
32.0
),
new
IconButton
(
icon:
const
Icon
(
Icons
.
chevron_left
),
padding:
EdgeInsets
.
zero
,
tooltip:
'Previous page'
,
tooltip:
localizations
.
previousPageTooltip
,
onPressed:
_firstRowIndex
<=
0
?
null
:
_handlePrevious
),
new
Container
(
width:
24.0
),
new
IconButton
(
icon:
const
Icon
(
Icons
.
chevron_right
),
padding:
EdgeInsets
.
zero
,
tooltip:
'Next page'
,
tooltip:
localizations
.
nextPageTooltip
,
onPressed:
(!
_rowCountApproximate
&&
(
_firstRowIndex
+
widget
.
rowsPerPage
>=
_rowCount
))
?
null
:
_handleNext
),
new
Container
(
width:
14.0
),
...
...
packages/flutter/lib/src/material/popup_menu.dart
View file @
96a70e89
...
...
@@ -14,6 +14,7 @@ import 'icons.dart';
import
'ink_well.dart'
;
import
'list_tile.dart'
;
import
'material.dart'
;
import
'material_localizations.dart'
;
import
'theme.dart'
;
// Examples can assume:
...
...
@@ -674,7 +675,7 @@ class PopupMenuButton<T> extends StatefulWidget {
@required
this
.
itemBuilder
,
this
.
initialValue
,
this
.
onSelected
,
this
.
tooltip
:
'Show menu'
,
this
.
tooltip
,
this
.
elevation
:
8.0
,
this
.
padding
:
const
EdgeInsets
.
all
(
8.0
),
this
.
child
,
...
...
@@ -765,7 +766,7 @@ class _PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
:
new
IconButton
(
icon:
widget
.
icon
??
_getIcon
(
Theme
.
of
(
context
).
platform
),
padding:
widget
.
padding
,
tooltip:
widget
.
tooltip
,
tooltip:
widget
.
tooltip
??
MaterialLocalizations
.
of
(
context
).
showMenuTooltip
,
onPressed:
showButtonMenu
,
);
}
...
...
packages/flutter/lib/src/widgets/app.dart
View file @
96a70e89
...
...
@@ -299,6 +299,21 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
Locale
_locale
;
Locale
_resolveLocale
(
Locale
newLocale
,
Iterable
<
Locale
>
supportedLocales
)
{
// Android devices (Java really) report 3 deprecated language codes, see
// http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4140555
// and https://developer.android.com/reference/java/util/Locale.html
switch
(
newLocale
.
languageCode
)
{
case
'iw'
:
newLocale
=
new
Locale
(
'he'
,
newLocale
.
countryCode
);
// Hebrew
break
;
case
'ji'
:
newLocale
=
new
Locale
(
'yi'
,
newLocale
.
countryCode
);
// Yiddish
break
;
case
'in'
:
newLocale
=
new
Locale
(
'id'
,
newLocale
.
countryCode
);
// Indonesian
break
;
}
if
(
widget
.
localeResolutionCallback
!=
null
)
{
final
Locale
locale
=
widget
.
localeResolutionCallback
(
newLocale
,
widget
.
supportedLocales
);
if
(
locale
!=
null
)
...
...
packages/flutter/test/material/localizations_test.dart
View file @
96a70e89
...
...
@@ -8,14 +8,15 @@ import 'package:flutter_test/flutter_test.dart';
Widget
buildFrame
(
{
Locale
locale
,
WidgetBuilder
buildContent
,
Iterable
<
Locale
>
supportedLocales:
const
<
Locale
>[
const
Locale
(
'en'
,
'US'
),
const
Locale
(
'es'
,
'es'
),
],
})
{
return
new
MaterialApp
(
color:
const
Color
(
0xFFFFFFFF
),
locale:
locale
,
supportedLocales:
const
<
Locale
>[
const
Locale
(
'en'
,
'US'
),
const
Locale
(
'es'
,
'es'
),
],
supportedLocales:
supportedLocales
,
onGenerateRoute:
(
RouteSettings
settings
)
{
return
new
MaterialPageRoute
<
Null
>(
builder:
(
BuildContext
context
)
{
...
...
@@ -77,12 +78,17 @@ void main() {
for
(
String
language
in
languages
)
{
final
Locale
locale
=
new
Locale
(
language
,
''
);
final
MaterialLocalizations
localizations
=
new
DefaultMaterialLocalizations
(
locale
);
expect
(
localizations
.
openAppDrawerTooltip
,
isNotNull
);
expect
(
localizations
.
backButtonTooltip
,
isNotNull
);
expect
(
localizations
.
closeButtonTooltip
,
isNotNull
);
expect
(
localizations
.
nextMonthTooltip
,
isNotNull
);
expect
(
localizations
.
previousMonthTooltip
,
isNotNull
);
expect
(
localizations
.
nextPageTooltip
,
isNotNull
);
expect
(
localizations
.
previousPageTooltip
,
isNotNull
);
expect
(
localizations
.
showMenuTooltip
,
isNotNull
);
expect
(
localizations
.
licensesPageTitle
,
isNotNull
);
expect
(
localizations
.
rowsPerPageTitle
,
isNotNull
);
expect
(
localizations
.
cancelButtonLabel
,
isNotNull
);
expect
(
localizations
.
closeButtonLabel
,
isNotNull
);
expect
(
localizations
.
continueButtonLabel
,
isNotNull
);
...
...
@@ -92,6 +98,77 @@ void main() {
expect
(
localizations
.
pasteButtonLabel
,
isNotNull
);
expect
(
localizations
.
selectAllButtonLabel
,
isNotNull
);
expect
(
localizations
.
viewLicensesButtonLabel
,
isNotNull
);
expect
(
localizations
.
selectedRowCountTitle
(
0
),
isNotNull
);
expect
(
localizations
.
selectedRowCountTitle
(
1
),
isNotNull
);
expect
(
localizations
.
selectedRowCountTitle
(
2
),
isNotNull
);
expect
(
localizations
.
selectedRowCountTitle
(
100
),
isNotNull
);
expect
(
localizations
.
selectedRowCountTitle
(
0
).
contains
(
r'$selectedRowCount'
),
isFalse
);
expect
(
localizations
.
selectedRowCountTitle
(
1
).
contains
(
r'$selectedRowCount'
),
isFalse
);
expect
(
localizations
.
selectedRowCountTitle
(
2
).
contains
(
r'$selectedRowCount'
),
isFalse
);
expect
(
localizations
.
selectedRowCountTitle
(
100
).
contains
(
r'$selectedRowCount'
),
isFalse
);
expect
(
localizations
.
pageRowsInfoTitle
(
1
,
10
,
100
,
true
),
isNotNull
);
expect
(
localizations
.
pageRowsInfoTitle
(
1
,
10
,
100
,
false
),
isNotNull
);
expect
(
localizations
.
pageRowsInfoTitle
(
1
,
10
,
100
,
true
).
contains
(
r'$firstRow'
),
isFalse
);
expect
(
localizations
.
pageRowsInfoTitle
(
1
,
10
,
100
,
true
).
contains
(
r'$lastRow'
),
isFalse
);
expect
(
localizations
.
pageRowsInfoTitle
(
1
,
10
,
100
,
true
).
contains
(
r'$rowCount'
),
isFalse
);
expect
(
localizations
.
pageRowsInfoTitle
(
1
,
10
,
100
,
false
).
contains
(
r'$firstRow'
),
isFalse
);
expect
(
localizations
.
pageRowsInfoTitle
(
1
,
10
,
100
,
false
).
contains
(
r'$lastRow'
),
isFalse
);
expect
(
localizations
.
pageRowsInfoTitle
(
1
,
10
,
100
,
false
).
contains
(
r'$rowCount'
),
isFalse
);
}
});
testWidgets
(
'spot check selectedRowCount translations'
,
(
WidgetTester
tester
)
async
{
MaterialLocalizations
localizations
=
new
DefaultMaterialLocalizations
(
const
Locale
(
'en'
,
''
));
expect
(
localizations
.
selectedRowCountTitle
(
0
),
'No items selected'
);
expect
(
localizations
.
selectedRowCountTitle
(
1
),
'1 item selected'
);
expect
(
localizations
.
selectedRowCountTitle
(
2
),
'2 items selected'
);
expect
(
localizations
.
selectedRowCountTitle
(
123456789
),
'123,456,789 items selected'
);
localizations
=
new
DefaultMaterialLocalizations
(
const
Locale
(
'es'
,
''
));
expect
(
localizations
.
selectedRowCountTitle
(
0
),
'No se han seleccionado elementos'
);
expect
(
localizations
.
selectedRowCountTitle
(
1
),
'1 artículo seleccionado'
);
expect
(
localizations
.
selectedRowCountTitle
(
2
),
'2 artículos seleccionados'
);
expect
(
localizations
.
selectedRowCountTitle
(
123456789
),
'123.456.789 artículos seleccionados'
);
});
testWidgets
(
'deprecated Android/Java locales are modernized'
,
(
WidgetTester
tester
)
async
{
final
Key
textKey
=
new
UniqueKey
();
await
tester
.
pumpWidget
(
buildFrame
(
supportedLocales:
<
Locale
>[
const
Locale
(
'en'
,
'US'
),
const
Locale
(
'he'
,
'IL'
),
const
Locale
(
'yi'
,
'IL'
),
const
Locale
(
'id'
,
'JV'
),
],
buildContent:
(
BuildContext
context
)
{
return
new
Text
(
'
${Localizations.localeOf(context)}
'
,
key:
textKey
,
);
},
)
);
expect
(
tester
.
widget
<
Text
>(
find
.
byKey
(
textKey
)).
data
,
'en_US'
);
// Hebrew was iw (ISO-639) is he (ISO-639-1)
await
tester
.
binding
.
setLocale
(
'iw'
,
'IL'
);
await
tester
.
pump
();
expect
(
tester
.
widget
<
Text
>(
find
.
byKey
(
textKey
)).
data
,
'he_IL'
);
// Yiddish was ji (ISO-639) is yi (ISO-639-1)
await
tester
.
binding
.
setLocale
(
'ji'
,
'IL'
);
await
tester
.
pump
();
expect
(
tester
.
widget
<
Text
>(
find
.
byKey
(
textKey
)).
data
,
'yi_IL'
);
// Indonesian was in (ISO-639) is id (ISO-639-1)
await
tester
.
binding
.
setLocale
(
'in'
,
'JV'
);
await
tester
.
pump
();
expect
(
tester
.
widget
<
Text
>(
find
.
byKey
(
textKey
)).
data
,
'id_JV'
);
});
}
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