Unverified Commit 291602db authored by Yegor's avatar Yegor Committed by GitHub

localize a11y tab labels in the TabBar (#13714)

* localize a11y tab labels in the TabBar

* break import cycle

* test boilerplate

* fix German translation

* more test boilerplate fixes
parent 68736081
...@@ -85,6 +85,14 @@ abstract class MaterialLocalizations { ...@@ -85,6 +85,14 @@ abstract class MaterialLocalizations {
/// Title for the [PaginatedDataTable]'s "rows per page" footer. /// Title for the [PaginatedDataTable]'s "rows per page" footer.
String get rowsPerPageTitle; String get rowsPerPageTitle;
/// The accessibility label used on a tab in a [TabBar].
///
/// This message describes the index of the selected tab and how many tabs
/// there are, e.g. 'Tab 1 of 2' in United States English.
///
/// `tabIndex` and `tabCount` must be greater than or equal to one.
String tabLabel({int tabIndex, int tabCount});
/// Title for the [PaginatedDataTable]'s selected row count header. /// Title for the [PaginatedDataTable]'s selected row count header.
String selectedRowCountTitle(int selectedRowCount); String selectedRowCountTitle(int selectedRowCount);
...@@ -517,6 +525,13 @@ class DefaultMaterialLocalizations implements MaterialLocalizations { ...@@ -517,6 +525,13 @@ class DefaultMaterialLocalizations implements MaterialLocalizations {
@override @override
String get rowsPerPageTitle => 'Rows per page:'; String get rowsPerPageTitle => 'Rows per page:';
@override
String tabLabel({int tabIndex, int tabCount}) {
assert(tabIndex >= 1);
assert(tabCount >= 1);
return 'Tab $tabIndex of $tabCount';
}
@override @override
String selectedRowCountTitle(int selectedRowCount) { String selectedRowCountTitle(int selectedRowCount) {
switch (selectedRowCount) { switch (selectedRowCount) {
......
...@@ -16,6 +16,7 @@ import 'constants.dart'; ...@@ -16,6 +16,7 @@ import 'constants.dart';
import 'debug.dart'; import 'debug.dart';
import 'ink_well.dart'; import 'ink_well.dart';
import 'material.dart'; import 'material.dart';
import 'material_localizations.dart';
import 'tab_controller.dart'; import 'tab_controller.dart';
import 'theme.dart'; import 'theme.dart';
...@@ -747,6 +748,7 @@ class _TabBarState extends State<TabBar> { ...@@ -747,6 +748,7 @@ class _TabBarState extends State<TabBar> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final MaterialLocalizations localizations = MaterialLocalizations.of(context);
if (_controller.length == 0) { if (_controller.length == 0) {
return new Container( return new Container(
height: _kTabHeight + widget.indicatorWeight, height: _kTabHeight + widget.indicatorWeight,
...@@ -811,8 +813,7 @@ class _TabBarState extends State<TabBar> { ...@@ -811,8 +813,7 @@ class _TabBarState extends State<TabBar> {
wrappedTabs[index], wrappedTabs[index],
new Semantics( new Semantics(
selected: index == _currentIndex, selected: index == _currentIndex,
// TODO(goderbauer): I10N-ify label: localizations.tabLabel(tabIndex: index + 1, tabCount: tabCount),
label: 'Tab ${index + 1} of $tabCount',
), ),
] ]
), ),
......
...@@ -8,33 +8,40 @@ import 'package:flutter/rendering.dart'; ...@@ -8,33 +8,40 @@ import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
Widget buildSliverAppBarApp({ bool floating, bool pinned, double expandedHeight, bool snap: false }) { Widget buildSliverAppBarApp({ bool floating, bool pinned, double expandedHeight, bool snap: false }) {
return new Directionality( return new Localizations(
textDirection: TextDirection.ltr, locale: const Locale('en', 'US'),
child: new MediaQuery( delegates: <LocalizationsDelegate<dynamic>>[
data: const MediaQueryData(), DefaultMaterialLocalizations.delegate,
child: new Scaffold( DefaultWidgetsLocalizations.delegate,
body: new DefaultTabController( ],
length: 3, child: new Directionality(
child: new CustomScrollView( textDirection: TextDirection.ltr,
primary: true, child: new MediaQuery(
slivers: <Widget>[ data: const MediaQueryData(),
new SliverAppBar( child: new Scaffold(
title: const Text('AppBar Title'), body: new DefaultTabController(
floating: floating, length: 3,
pinned: pinned, child: new CustomScrollView(
expandedHeight: expandedHeight, primary: true,
snap: snap, slivers: <Widget>[
bottom: new TabBar( new SliverAppBar(
tabs: <String>['A','B','C'].map((String t) => new Tab(text: 'TAB $t')).toList(), title: const Text('AppBar Title'),
floating: floating,
pinned: pinned,
expandedHeight: expandedHeight,
snap: snap,
bottom: new TabBar(
tabs: <String>['A','B','C'].map((String t) => new Tab(text: 'TAB $t')).toList(),
),
), ),
), new SliverToBoxAdapter(
new SliverToBoxAdapter( child: new Container(
child: new Container( height: 1200.0,
height: 1200.0, color: Colors.orange[400],
color: Colors.orange[400], ),
), ),
), ],
], ),
), ),
), ),
), ),
......
...@@ -15,10 +15,17 @@ import '../rendering/recording_canvas.dart'; ...@@ -15,10 +15,17 @@ import '../rendering/recording_canvas.dart';
import '../widgets/semantics_tester.dart'; import '../widgets/semantics_tester.dart';
Widget boilerplate({ Widget child, TextDirection textDirection: TextDirection.ltr }) { Widget boilerplate({ Widget child, TextDirection textDirection: TextDirection.ltr }) {
return new Directionality( return new Localizations(
textDirection: textDirection, locale: const Locale('en', 'US'),
child: new Material( delegates: <LocalizationsDelegate<dynamic>>[
child: child, DefaultMaterialLocalizations.delegate,
DefaultWidgetsLocalizations.delegate,
],
child: new Directionality(
textDirection: textDirection,
child: new Material(
child: child,
),
), ),
); );
} }
......
...@@ -21,75 +21,82 @@ class _CustomPhysics extends ClampingScrollPhysics { ...@@ -21,75 +21,82 @@ class _CustomPhysics extends ClampingScrollPhysics {
} }
Widget buildTest({ ScrollController controller, String title:'TTTTTTTT' }) { Widget buildTest({ ScrollController controller, String title:'TTTTTTTT' }) {
return new Directionality( return new Localizations(
textDirection: TextDirection.ltr, locale: const Locale('en', 'US'),
child: new MediaQuery( delegates: <LocalizationsDelegate<dynamic>>[
data: const MediaQueryData(), DefaultMaterialLocalizations.delegate,
child: new Scaffold( DefaultWidgetsLocalizations.delegate,
body: new DefaultTabController( ],
length: 4, child: new Directionality(
child: new NestedScrollView( textDirection: TextDirection.ltr,
controller: controller, child: new MediaQuery(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { data: const MediaQueryData(),
return <Widget>[ child: new Scaffold(
new SliverAppBar( body: new DefaultTabController(
title: new Text(title), length: 4,
pinned: true, child: new NestedScrollView(
expandedHeight: 200.0, controller: controller,
forceElevated: innerBoxIsScrolled, headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
bottom: const TabBar( return <Widget>[
tabs: const <Tab>[ new SliverAppBar(
const Tab(text: 'AA'), title: new Text(title),
const Tab(text: 'BB'), pinned: true,
const Tab(text: 'CC'), expandedHeight: 200.0,
const Tab(text: 'DD'), forceElevated: innerBoxIsScrolled,
bottom: const TabBar(
tabs: const <Tab>[
const Tab(text: 'AA'),
const Tab(text: 'BB'),
const Tab(text: 'CC'),
const Tab(text: 'DD'),
],
),
),
];
},
body: new TabBarView(
children: <Widget>[
new ListView(
children: <Widget>[
new Container(
height: 300.0,
child: const Text('aaa1'),
),
new Container(
height: 200.0,
child: const Text('aaa2'),
),
new Container(
height: 100.0,
child: const Text('aaa3'),
),
new Container(
height: 50.0,
child: const Text('aaa4'),
),
], ],
), ),
), new ListView(
]; children: <Widget>[
}, new Container(
body: new TabBarView( height: 100.0,
children: <Widget>[ child: const Text('bbb1'),
new ListView( ),
children: <Widget>[ ],
new Container( ),
height: 300.0, new Container(
child: const Text('aaa1'), child: const Center(child: const Text('ccc1')),
), ),
new Container( new ListView(
height: 200.0, children: <Widget>[
child: const Text('aaa2'), new Container(
), height: 10000.0,
new Container( child: const Text('ddd1'),
height: 100.0, ),
child: const Text('aaa3'), ],
), ),
new Container( ],
height: 50.0, ),
child: const Text('aaa4'),
),
],
),
new ListView(
children: <Widget>[
new Container(
height: 100.0,
child: const Text('bbb1'),
),
],
),
new Container(
child: const Center(child: const Text('ccc1')),
),
new ListView(
children: <Widget>[
new Container(
height: 10000.0,
child: const Text('ddd1'),
),
],
),
],
), ),
), ),
), ),
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"pageRowsInfoTitle": "من $firstRow إلى $lastRow من إجمالي $rowCount", "pageRowsInfoTitle": "من $firstRow إلى $lastRow من إجمالي $rowCount",
"pageRowsInfoTitleApproximate": "من $firstRow إلى $lastRow من إجمالي $rowCount تقريبًا", "pageRowsInfoTitleApproximate": "من $firstRow إلى $lastRow من إجمالي $rowCount تقريبًا",
"rowsPerPageTitle": "عدد الصفوف في الصفحة:", "rowsPerPageTitle": "عدد الصفوف في الصفحة:",
"tabLabel": "من $tabIndex من إجمالي $tabCount",
"selectedRowCountTitleOther": "تم اختيار $selectedRowCount عنصر", "selectedRowCountTitleOther": "تم اختيار $selectedRowCount عنصر",
"cancelButtonLabel": "إلغاء", "cancelButtonLabel": "إلغاء",
"closeButtonLabel": "إغلاق", "closeButtonLabel": "إغلاق",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"pageRowsInfoTitle": "$firstRow–$lastRow von $rowCount", "pageRowsInfoTitle": "$firstRow–$lastRow von $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow–$lastRow von etwa $rowCount", "pageRowsInfoTitleApproximate": "$firstRow–$lastRow von etwa $rowCount",
"rowsPerPageTitle": "Zeilen pro Seite:", "rowsPerPageTitle": "Zeilen pro Seite:",
"tabLabel": "Tabulator $tabIndex von $tabCount",
"selectedRowCountTitleZero": "Keine Objekte ausgewählt", "selectedRowCountTitleZero": "Keine Objekte ausgewählt",
"selectedRowCountTitleOne": "1 Element ausgewählt", "selectedRowCountTitleOne": "1 Element ausgewählt",
"selectedRowCountTitleOther": "$selectedRowCount Elemente ausgewählt", "selectedRowCountTitleOther": "$selectedRowCount Elemente ausgewählt",
......
...@@ -82,6 +82,12 @@ ...@@ -82,6 +82,12 @@
"description": "The caption for the drop-down button on a paginated data table's footer that allows the user to control the number of rows of data per page of the table." "description": "The caption for the drop-down button on a paginated data table's footer that allows the user to control the number of rows of data per page of the table."
}, },
"tabLabel": "Tab $tabIndex of $tabCount",
"@tabLabel": {
"description": "The accessibility label used on a tab. This message describes the index of the selected tab and how many tabs there are, e.g. 'Tab 1 of 2'. All values are greater than or equal to one.",
"parameters": "tabIndex, tabCount"
},
"selectedRowCountTitleZero": "No items selected", "selectedRowCountTitleZero": "No items selected",
"selectedRowCountTitleOne": "1 item selected", "selectedRowCountTitleOne": "1 item selected",
"selectedRowCountTitleOther": "$selectedRowCount items selected", "selectedRowCountTitleOther": "$selectedRowCount items selected",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"pageRowsInfoTitle": "$firstRow‑$lastRow de $rowCount", "pageRowsInfoTitle": "$firstRow‑$lastRow de $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow‑$lastRow de aproximadamente $rowCount", "pageRowsInfoTitleApproximate": "$firstRow‑$lastRow de aproximadamente $rowCount",
"rowsPerPageTitle": "Filas por página:", "rowsPerPageTitle": "Filas por página:",
"tabLabel": "$tabIndex de $tabCount",
"selectedRowCountTitleZero": "No se han seleccionado elementos", "selectedRowCountTitleZero": "No se han seleccionado elementos",
"selectedRowCountTitleOne": "1 elemento seleccionado", "selectedRowCountTitleOne": "1 elemento seleccionado",
"selectedRowCountTitleOther": "$selectedRowCount elementos seleccionados", "selectedRowCountTitleOther": "$selectedRowCount elementos seleccionados",
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"pageRowsInfoTitle": "$firstRow–$lastRow از $rowCount", "pageRowsInfoTitle": "$firstRow–$lastRow از $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow–$lastRow از حدود $rowCount", "pageRowsInfoTitleApproximate": "$firstRow–$lastRow از حدود $rowCount",
"rowsPerPageTitle": "ردیف در هر صفحه:", "rowsPerPageTitle": "ردیف در هر صفحه:",
"tabLabel": "$tabIndex از $tabCount",
"selectedRowCountTitleOther": "$selectedRowCount مورد انتخاب شدند", "selectedRowCountTitleOther": "$selectedRowCount مورد انتخاب شدند",
"cancelButtonLabel": "لغو", "cancelButtonLabel": "لغو",
"closeButtonLabel": "بستن", "closeButtonLabel": "بستن",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"pageRowsInfoTitle": "$firstRow – $lastRow sur $rowCount", "pageRowsInfoTitle": "$firstRow – $lastRow sur $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow – $lastRow sur environ $rowCount", "pageRowsInfoTitleApproximate": "$firstRow – $lastRow sur environ $rowCount",
"rowsPerPageTitle": "Lignes par page :", "rowsPerPageTitle": "Lignes par page :",
"tabLabel": "$tabIndex sur $tabCount",
"selectedRowCountTitleZero": "Aucun élément sélectionné", "selectedRowCountTitleZero": "Aucun élément sélectionné",
"selectedRowCountTitleOne": "1 élément sélectionné", "selectedRowCountTitleOne": "1 élément sélectionné",
"selectedRowCountTitleOther": "$selectedRowCount éléments sélectionnés", "selectedRowCountTitleOther": "$selectedRowCount éléments sélectionnés",
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
"pageRowsInfoTitle": "$lastRow–$firstRow מתוך $rowCount", "pageRowsInfoTitle": "$lastRow–$firstRow מתוך $rowCount",
"pageRowsInfoTitleApproximate": "$lastRow–$firstRow מתוך כ-$rowCount", "pageRowsInfoTitleApproximate": "$lastRow–$firstRow מתוך כ-$rowCount",
"rowsPerPageTitle": "שורות בכל דף:", "rowsPerPageTitle": "שורות בכל דף:",
"tabLabel": "$tabIndex מתוך $tabCount",
"selectedRowCountTitleOther": "$selectedRowCount פריטים נבחרו", "selectedRowCountTitleOther": "$selectedRowCount פריטים נבחרו",
"cancelButtonLabel": "ביטול", "cancelButtonLabel": "ביטול",
"closeButtonLabel": "סגירה", "closeButtonLabel": "סגירה",
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"pageRowsInfoTitle": "$firstRow-$lastRow di $rowCount", "pageRowsInfoTitle": "$firstRow-$lastRow di $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow-$lastRow di circa $rowCount", "pageRowsInfoTitleApproximate": "$firstRow-$lastRow di circa $rowCount",
"rowsPerPageTitle": "Righe per pagina:", "rowsPerPageTitle": "Righe per pagina:",
"tabLabel": "$tabIndex di $tabCount",
"selectedRowCountTitleOther": "$selectedRowCount elementi selezionati", "selectedRowCountTitleOther": "$selectedRowCount elementi selezionati",
"cancelButtonLabel": "ANNULLA", "cancelButtonLabel": "ANNULLA",
"closeButtonLabel": "CHIUDI", "closeButtonLabel": "CHIUDI",
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"pageRowsInfoTitle": "$firstRow - $lastRow 行(合計 $rowCount 行)", "pageRowsInfoTitle": "$firstRow - $lastRow 行(合計 $rowCount 行)",
"pageRowsInfoTitleApproximate": "$firstRow – $lastRow 行(合計約 $rowCount 行)", "pageRowsInfoTitleApproximate": "$firstRow – $lastRow 行(合計約 $rowCount 行)",
"rowsPerPageTitle": "ページあたりの行数:", "rowsPerPageTitle": "ページあたりの行数:",
"tabLabel": "$tabIndex 行(合計 $tabCount 行)",
"selectedRowCountTitleOther": "$selectedRowCount 件のアイテムを選択中", "selectedRowCountTitleOther": "$selectedRowCount 件のアイテムを選択中",
"cancelButtonLabel": "キャンセル", "cancelButtonLabel": "キャンセル",
"closeButtonLabel": "閉じる", "closeButtonLabel": "閉じる",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"pageRowsInfoTitle": "$rowCount행 중 $firstRow~$lastRow행", "pageRowsInfoTitle": "$rowCount행 중 $firstRow~$lastRow행",
"pageRowsInfoTitleApproximate": "약 $rowCount행 중 $firstRow~$lastRow행", "pageRowsInfoTitleApproximate": "약 $rowCount행 중 $firstRow~$lastRow행",
"rowsPerPageTitle": "페이지당 행 수:", "rowsPerPageTitle": "페이지당 행 수:",
"tabLabel": "$tabCount행 중 $tabIndex행",
"selectedRowCountTitleOne": "항목 1개 선택됨", "selectedRowCountTitleOne": "항목 1개 선택됨",
"selectedRowCountTitleOther": "항목 $selectedRowCount개 선택됨", "selectedRowCountTitleOther": "항목 $selectedRowCount개 선택됨",
"cancelButtonLabel": "취소", "cancelButtonLabel": "취소",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"pageRowsInfoTitle": "$firstRow-$lastRow van $rowCount", "pageRowsInfoTitle": "$firstRow-$lastRow van $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow-$lastRow van ongeveer $rowCount", "pageRowsInfoTitleApproximate": "$firstRow-$lastRow van ongeveer $rowCount",
"rowsPerPageTitle": "Rijen per pagina:", "rowsPerPageTitle": "Rijen per pagina:",
"tabLabel": "$tabIndex van $tabCount",
"selectedRowCountTitleOne": "1 item geselecteerd", "selectedRowCountTitleOne": "1 item geselecteerd",
"selectedRowCountTitleOther": "$selectedRowCount items geselecteerd", "selectedRowCountTitleOther": "$selectedRowCount items geselecteerd",
"cancelButtonLabel": "ANNULEREN", "cancelButtonLabel": "ANNULEREN",
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
"pageRowsInfoTitle": "$firstRow–$lastRow z $rowCount", "pageRowsInfoTitle": "$firstRow–$lastRow z $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow–$lastRow z około $rowCount", "pageRowsInfoTitleApproximate": "$firstRow–$lastRow z około $rowCount",
"rowsPerPageTitle": "Wiersze na stronie:", "rowsPerPageTitle": "Wiersze na stronie:",
"tabLabel": "$tabIndex z $tabCount",
"selectedRowCountTitleOne": "1 wybrany element", "selectedRowCountTitleOne": "1 wybrany element",
"selectedRowCountTitleOther": "$selectedRowCount wybranego elementu", "selectedRowCountTitleOther": "$selectedRowCount wybranego elementu",
"cancelButtonLabel": "ANULUJ", "cancelButtonLabel": "ANULUJ",
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
"pageRowsInfoTitle": "$firstRow–$lastRow د $rowCount", "pageRowsInfoTitle": "$firstRow–$lastRow د $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow–$lastRow څخه $rowCount د", "pageRowsInfoTitleApproximate": "$firstRow–$lastRow څخه $rowCount د",
"rowsPerPageTitle": "د هرې پاڼې پاڼې:", "rowsPerPageTitle": "د هرې پاڼې پاڼې:",
"tabLabel": "$tabIndex د $tabCount",
"selectedRowCountTitleOther": "$selectedRowCount توکي غوره شوي", "selectedRowCountTitleOther": "$selectedRowCount توکي غوره شوي",
"cancelButtonLabel": "لغوه کول", "cancelButtonLabel": "لغوه کول",
"closeButtonLabel": "تړل", "closeButtonLabel": "تړل",
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"pageRowsInfoTitle": "$firstRow – $lastRow de $rowCount", "pageRowsInfoTitle": "$firstRow – $lastRow de $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow – $lastRow de aproximadamente $rowCount", "pageRowsInfoTitleApproximate": "$firstRow – $lastRow de aproximadamente $rowCount",
"rowsPerPageTitle": "Linhas por página:", "rowsPerPageTitle": "Linhas por página:",
"tabLabel": "$tabIndex de $tabCount",
"selectedRowCountTitleOther": "$selectedRowCount itens selecionados", "selectedRowCountTitleOther": "$selectedRowCount itens selecionados",
"cancelButtonLabel": "CANCELAR", "cancelButtonLabel": "CANCELAR",
"closeButtonLabel": "FECHAR", "closeButtonLabel": "FECHAR",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"pageRowsInfoTitle": "$firstRow–$lastRow из $rowCount", "pageRowsInfoTitle": "$firstRow–$lastRow из $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow–$lastRow из примерно $rowCount", "pageRowsInfoTitleApproximate": "$firstRow–$lastRow из примерно $rowCount",
"rowsPerPageTitle": "Строк на странице:", "rowsPerPageTitle": "Строк на странице:",
"tabLabel": "Закладка $tabIndex из $tabCount",
"aboutListTileTitle": "$applicationName: сведения", "aboutListTileTitle": "$applicationName: сведения",
"licensesPageTitle": "Лицензии", "licensesPageTitle": "Лицензии",
"selectedRowCountTitleZero": "Строки не выбраны", "selectedRowCountTitleZero": "Строки не выбраны",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"pageRowsInfoTitle": "$firstRow-$lastRow จาก $rowCount", "pageRowsInfoTitle": "$firstRow-$lastRow จาก $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow–$lastRow จากประมาณ $rowCount", "pageRowsInfoTitleApproximate": "$firstRow–$lastRow จากประมาณ $rowCount",
"rowsPerPageTitle": "แถวต่อหน้า:", "rowsPerPageTitle": "แถวต่อหน้า:",
"tabLabel": "$tabIndex จาก $tabCount",
"selectedRowCountTitleOne": "เลือกแล้ว 1 รายการ", "selectedRowCountTitleOne": "เลือกแล้ว 1 รายการ",
"selectedRowCountTitleOther": "เลือกแล้ว $selectedRowCount รายการ", "selectedRowCountTitleOther": "เลือกแล้ว $selectedRowCount รายการ",
"cancelButtonLabel": "ยกเลิก", "cancelButtonLabel": "ยกเลิก",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"pageRowsInfoTitle": "$firstRow-$lastRow / $rowCount", "pageRowsInfoTitle": "$firstRow-$lastRow / $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow-$lastRow / $rowCount", "pageRowsInfoTitleApproximate": "$firstRow-$lastRow / $rowCount",
"rowsPerPageTitle": "Sayfa başına satır sayısı:", "rowsPerPageTitle": "Sayfa başına satır sayısı:",
"tabLabel": "$tabIndex, $tabCount içinde",
"selectedRowCountTitleOne": "1 öğe seçildi", "selectedRowCountTitleOne": "1 öğe seçildi",
"selectedRowCountTitleOther": "$selectedRowCount öğe seçildi", "selectedRowCountTitleOther": "$selectedRowCount öğe seçildi",
"cancelButtonLabel": "İPTAL", "cancelButtonLabel": "İPTAL",
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"pageRowsInfoTitle": "$firstRow–$lastRow از $rowCount", "pageRowsInfoTitle": "$firstRow–$lastRow از $rowCount",
"pageRowsInfoTitleApproximate": "$firstRow–$lastRow $rowCount میں سے تقریباً", "pageRowsInfoTitleApproximate": "$firstRow–$lastRow $rowCount میں سے تقریباً",
"rowsPerPageTitle": "قطاریں فی صفحہ:", "rowsPerPageTitle": "قطاریں فی صفحہ:",
"tabLabel": "$tabIndex از $tabCount",
"selectedRowCountTitleOther": "$selectedRowCount آئٹمز منتخب کیے گئے", "selectedRowCountTitleOther": "$selectedRowCount آئٹمز منتخب کیے گئے",
"cancelButtonLabel": "منسوخ کریں", "cancelButtonLabel": "منسوخ کریں",
"closeButtonLabel": "بند کریں", "closeButtonLabel": "بند کریں",
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"pageRowsInfoTitle": "第 $firstRow-$lastRow 行(共 $rowCount 行)", "pageRowsInfoTitle": "第 $firstRow-$lastRow 行(共 $rowCount 行)",
"pageRowsInfoTitleApproximate": "第 $firstRow-$lastRow 行(共约 $rowCount 行)", "pageRowsInfoTitleApproximate": "第 $firstRow-$lastRow 行(共约 $rowCount 行)",
"rowsPerPageTitle": "每页行数:", "rowsPerPageTitle": "每页行数:",
"tabLabel": "第 $tabIndex 行(共 $tabCount 行)",
"selectedRowCountTitleOther": "已选择 $selectedRowCount 项内容", "selectedRowCountTitleOther": "已选择 $selectedRowCount 项内容",
"cancelButtonLabel": "取消", "cancelButtonLabel": "取消",
"continueButtonLabel": "继续", "continueButtonLabel": "继续",
......
...@@ -272,6 +272,16 @@ class GlobalMaterialLocalizations implements MaterialLocalizations { ...@@ -272,6 +272,16 @@ class GlobalMaterialLocalizations implements MaterialLocalizations {
@override @override
String get rowsPerPageTitle => _translationBundle.rowsPerPageTitle; String get rowsPerPageTitle => _translationBundle.rowsPerPageTitle;
@override
String tabLabel({int tabIndex, int tabCount}) {
assert(tabIndex >= 1);
assert(tabCount >= 1);
final String template = _translationBundle.tabLabel;
return template
.replaceFirst(r'$tabIndex', formatDecimal(tabIndex))
.replaceFirst(r'tabCount', formatDecimal(tabCount));
}
@override @override
String selectedRowCountTitle(int selectedRowCount) { String selectedRowCountTitle(int selectedRowCount) {
// TODO(hmuller): the rules for mapping from an integer value to // TODO(hmuller): the rules for mapping from an integer value to
......
...@@ -61,19 +61,25 @@ void main() { ...@@ -61,19 +61,25 @@ void main() {
expect(localizations.selectedRowCountTitle(1), isNotNull); expect(localizations.selectedRowCountTitle(1), isNotNull);
expect(localizations.selectedRowCountTitle(2), isNotNull); expect(localizations.selectedRowCountTitle(2), isNotNull);
expect(localizations.selectedRowCountTitle(100), isNotNull); expect(localizations.selectedRowCountTitle(100), isNotNull);
expect(localizations.selectedRowCountTitle(0).contains(r'$selectedRowCount'), isFalse); expect(localizations.selectedRowCountTitle(0), isNot(contains(r'$selectedRowCount')));
expect(localizations.selectedRowCountTitle(1).contains(r'$selectedRowCount'), isFalse); expect(localizations.selectedRowCountTitle(1), isNot(contains(r'$selectedRowCount')));
expect(localizations.selectedRowCountTitle(2).contains(r'$selectedRowCount'), isFalse); expect(localizations.selectedRowCountTitle(2), isNot(contains(r'$selectedRowCount')));
expect(localizations.selectedRowCountTitle(100).contains(r'$selectedRowCount'), isFalse); expect(localizations.selectedRowCountTitle(100), isNot(contains(r'$selectedRowCount')));
expect(localizations.pageRowsInfoTitle(1, 10, 100, true), isNotNull); expect(localizations.pageRowsInfoTitle(1, 10, 100, true), isNotNull);
expect(localizations.pageRowsInfoTitle(1, 10, 100, false), 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), isNot(contains(r'$firstRow')));
expect(localizations.pageRowsInfoTitle(1, 10, 100, true).contains(r'$lastRow'), isFalse); expect(localizations.pageRowsInfoTitle(1, 10, 100, true), isNot(contains(r'$lastRow')));
expect(localizations.pageRowsInfoTitle(1, 10, 100, true).contains(r'$rowCount'), isFalse); expect(localizations.pageRowsInfoTitle(1, 10, 100, true), isNot(contains(r'$rowCount')));
expect(localizations.pageRowsInfoTitle(1, 10, 100, false).contains(r'$firstRow'), isFalse); expect(localizations.pageRowsInfoTitle(1, 10, 100, false), isNot(contains(r'$firstRow')));
expect(localizations.pageRowsInfoTitle(1, 10, 100, false).contains(r'$lastRow'), isFalse); expect(localizations.pageRowsInfoTitle(1, 10, 100, false), isNot(contains(r'$lastRow')));
expect(localizations.pageRowsInfoTitle(1, 10, 100, false).contains(r'$rowCount'), isFalse); expect(localizations.pageRowsInfoTitle(1, 10, 100, false), isNot(contains(r'$rowCount')));
expect(localizations.tabLabel(tabIndex: 2, tabCount: 5), isNotNull);
expect(localizations.tabLabel(tabIndex: 2, tabCount: 5), isNot(contains('tabIndex')));
expect(localizations.tabLabel(tabIndex: 2, tabCount: 5), isNot(contains('tabCount')));
expect(() => localizations.tabLabel(tabIndex: 0, tabCount: 5), throwsAssertionError);
expect(() => localizations.tabLabel(tabIndex: 2, tabCount: 0), throwsAssertionError);
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment