瀏覽代碼

Merge pull request #49 from nfuad/master

Add Bengali Language Support
刘彦博 6 年之前
父節點
當前提交
5b5ace708e
共有 2 個文件被更改,包括 179 次插入16 次删除
  1. 10 7
      README.md
  2. 169 9
      lib/src/i18n_model.dart

+ 10 - 7
README.md

@@ -22,21 +22,22 @@ you can choose date / time / date&time in multiple languages:
 - Japanese(jp)
 - German(de)
 - Danish(da)
+- Bengali(bn)
 
 and you can also custom your own picker content
 
-
-|Date picker|Time picker|Date Time picker|
-| ------- | ------- |------- |
-|![]( screen_date.png) |![]( screen_time.png) |![]( screen_datetime_chinese.png) |
+| Date picker          | Time picker          | Date Time picker                 |
+| -------------------- | -------------------- | -------------------------------- |
+| ![](screen_date.png) | ![](screen_time.png) | ![](screen_datetime_chinese.png) |
 
 International:
 
-| Date Time picker (Chinese) | Date Time picker (America) | Date Time picker (Dutch) | Date Time picker (Russian) |
-| ------- | ------- | ------- | ------- |
-|![]( screen_datetime_chinese.png)|![]( screen_datetime_english.png)|![]( screen_datetime_dutch.png)|![]( screen_datetime_russian.png)|
+| Date Time picker (Chinese)       | Date Time picker (America)       | Date Time picker (Dutch)       | Date Time picker (Russian)       |
+| -------------------------------- | -------------------------------- | ------------------------------ | -------------------------------- |
+| ![](screen_datetime_chinese.png) | ![](screen_datetime_english.png) | ![](screen_datetime_dutch.png) | ![](screen_datetime_russian.png) |
 
 ## Usage
+
 ```
 FlatButton(
     onPressed: () {
@@ -56,7 +57,9 @@ FlatButton(
 ```
 
 ## Custom
+
 If you want to customize your own style of date time picker, there is a class called CommonPickerModel, every type of date time picker is extended from this class, you can refer to other picker model (eg. DatePickerModel), and write your custom one, then pass this model to showPicker method, so that your own date time picker will appear, it’s easy, and will perfectly meet your demand
+
 ## Getting Started
 
 For help getting started with Flutter, view our online [documentation](https://flutter.io/).

+ 169 - 9
lib/src/i18n_model.dart

@@ -1,4 +1,23 @@
-enum LocaleType { en, fa, zh, nl, ru, it, fr, es, pl, pt, ko, ar, tr, jp, de, da, mn }
+enum LocaleType {
+  en,
+  fa,
+  zh,
+  nl,
+  ru,
+  it,
+  fr,
+  es,
+  pl,
+  pt,
+  ko,
+  ar,
+  tr,
+  jp,
+  de,
+  da,
+  mn,
+  bn
+}
 
 final _i18nModel = {
   'en': {
@@ -105,7 +124,15 @@ final _i18nModel = {
       'بهمن',
       'اسفند'
     ],
-    'day': ['دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنج شنبه', 'جمعه', 'شنبه', 'یکشنبه'],
+    'day': [
+      'دوشنبه',
+      'سه شنبه',
+      'چهارشنبه',
+      'پنج شنبه',
+      'جمعه',
+      'شنبه',
+      'یکشنبه'
+    ],
     'am': 'صبح',
     'pm': 'عصر'
   },
@@ -114,8 +141,34 @@ final _i18nModel = {
     'cancel': '取消',
     'done': '确定',
     'today': '今天',
-    'monthShort': ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
-    'monthLong': ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
+    'monthShort': [
+      '一月',
+      '二月',
+      '三月',
+      '四月',
+      '五月',
+      '六月',
+      '七月',
+      '八月',
+      '九月',
+      '十月',
+      '十一月',
+      '十二月'
+    ],
+    'monthLong': [
+      '一月',
+      '二月',
+      '三月',
+      '四月',
+      '五月',
+      '六月',
+      '七月',
+      '八月',
+      '九月',
+      '十月',
+      '十一月',
+      '十二月'
+    ],
     'day': ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'],
     'am': '上午',
     'pm': '下午'
@@ -385,8 +438,34 @@ final _i18nModel = {
     'cancel': '취소',
     'done': '완료',
     'today': '오늘',
-    'monthShort': ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
-    'monthLong': ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'],
+    'monthShort': [
+      '1월',
+      '2월',
+      '3월',
+      '4월',
+      '5월',
+      '6월',
+      '7월',
+      '8월',
+      '9월',
+      '10월',
+      '11월',
+      '12월'
+    ],
+    'monthLong': [
+      '1월',
+      '2월',
+      '3월',
+      '4월',
+      '5월',
+      '6월',
+      '7월',
+      '8월',
+      '9월',
+      '10월',
+      '11월',
+      '12월'
+    ],
     'day': ['월', '화', '수', '목', '금', '토', '일'],
     'am': '오전',
     'pm': '오후'
@@ -423,7 +502,15 @@ final _i18nModel = {
       'نوفمبر',
       'ديسمبر'
     ],
-    'day': ['الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعه', 'السبت', 'الاحد'],
+    'day': [
+      'الإثنين',
+      'الثلاثاء',
+      'الأربعاء',
+      'الخميس',
+      'الجمعه',
+      'السبت',
+      'الاحد'
+    ],
     'am': 'ص',
     'pm': 'م'
   },
@@ -468,8 +555,34 @@ final _i18nModel = {
     'cancel': 'キャンセル',
     'done': '決定する',
     'today': '今日',
-    'monthShort': ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
-    'monthLong': ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
+    'monthShort': [
+      '一月',
+      '二月',
+      '三月',
+      '四月',
+      '五月',
+      '六月',
+      '七月',
+      '八月',
+      '九月',
+      '十月',
+      '十一月',
+      '十二月'
+    ],
+    'monthLong': [
+      '一月',
+      '二月',
+      '三月',
+      '四月',
+      '五月',
+      '六月',
+      '七月',
+      '八月',
+      '九月',
+      '十月',
+      '十一月',
+      '十二月'
+    ],
     'day': ['月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日', '日曜日'],
     'am': '朝',
     'pm': '午後'
@@ -548,6 +661,51 @@ final _i18nModel = {
     'am': 'AM',
     'pm': 'PM'
   },
+  'bn': {
+//Bengali
+    'cancel': 'বাতিল',
+    'done': 'সম্পন্ন',
+    'today': 'আজ',
+    'monthShort': [
+      "জানু",
+      "ফেব্",
+      "মার্চ",
+      "এপ্রিল",
+      "মে",
+      "জুন",
+      "জুলাই",
+      "অগাস্ট",
+      "সেপ্ট",
+      "অক্ট",
+      "নভেম্",
+      "ডিসেম্"
+    ],
+    'monthLong': [
+      "জানুয়ারী",
+      "ফেব্রুয়ারি",
+      "মার্চ",
+      "এপ্রিল",
+      "মে",
+      "জুন",
+      "জুলাই",
+      "অগাস্ট",
+      "সেপ্টেম্বর",
+      "অক্টোবর",
+      "নভেম্বর",
+      "ডিসেম্বর"
+    ],
+    'day': [
+      "রবিবার",
+      "সোমবার",
+      "মঙ্গলবার",
+      "বুধবার",
+      "বৃহস্পতিবার",
+      "শুক্রবার",
+      "শনিবার",
+    ],
+    'am': 'AM',
+    'pm': 'PM'
+  },
 };
 //get international object
 Map<String, dynamic> i18nObjInLocale(LocaleType type) {
@@ -584,6 +742,8 @@ Map<String, dynamic> i18nObjInLocale(LocaleType type) {
       return _i18nModel['da'];
     case LocaleType.mn:
       return _i18nModel['mn'];
+    case LocaleType.bn:
+      return _i18nModel['bn'];
     default:
       return _i18nModel['en'];
   }