{"id":19777458,"url":"https://github.com/ilib-js/flutter_ilib","last_synced_at":"2026-01-05T07:27:34.267Z","repository":{"id":241853948,"uuid":"807943473","full_name":"iLib-js/flutter_ilib","owner":"iLib-js","description":"A flutter plugin to use iLib conveniently in Flutter apps","archived":false,"fork":false,"pushed_at":"2024-11-05T04:56:38.000Z","size":5570,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2024-11-05T05:29:03.548Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/flutter_ilib","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iLib-js.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-30T04:42:53.000Z","updated_at":"2024-10-11T00:48:14.000Z","dependencies_parsed_at":"2024-08-02T09:13:16.103Z","dependency_job_id":"f0dc9f45-eebf-458a-acc4-ec659439d970","html_url":"https://github.com/iLib-js/flutter_ilib","commit_stats":null,"previous_names":["ilib-js/flutter_ilib"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iLib-js%2Fflutter_ilib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iLib-js%2Fflutter_ilib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iLib-js%2Fflutter_ilib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iLib-js%2Fflutter_ilib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iLib-js","download_url":"https://codeload.github.com/iLib-js/flutter_ilib/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224222231,"owners_count":17275980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T05:25:03.759Z","updated_at":"2026-01-05T07:27:34.254Z","avatar_url":"https://github.com/iLib-js.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter_ilib\n\nA wrapper plugin to conveniently use [iLib](https://github.com/iLib-js/iLib) in Flutter app.  \nThe iLib is an internationalization library written in pure JavaScript.  \nThis plugin uses the [flutter_js](https://pub.dev/packages/flutter_js) to make the JavaScript file work properly in the Flutter app.\n\n## How to use\n### Initialization\nAdd the following import.\n```dart\nimport 'package:flutter_ilib/flutter_ilib.dart';\n```\nAdd a listener to get a callback message that ilib is ready to use.\n\n```dart\nfinal FlutterILib _flutterIlibPlugin = FlutterILib.instance;\n_flutterIlibPlugin.addListener(() {\n    // do Something.\n});\n```\n\n### Updating the locale\nSince version **v1.0.0**, the structure has been updated to load locale data only for the currently activated locale.  \nwhen the app is launched, the package automatically loads the locale data by detecting the system's locale.  \nTo load the updated locale data file when the locale changes, I suggest adding the following method at the appropriate time when the locale chanages.  \n\n``` _flutterIlibPlugin.loadLocaleData(curLocale);```  \n\nHere is an example of using the [localeResolutionCallback](https://api.flutter.dev/flutter/widgets/WidgetsApp/localeResolutionCallback.html)  property.  \ni.e:\n```dart\nLocale? appLocaleResolutionCallback(\n      Locale? locale,\n      Iterable\u003cLocale\u003e supportedLocales,\n    ) {\n      ...\n      _flutterIlibPlugin.loadLocaleData(locale);\n      ...\n    }\n```\n```dart\n@override\nWidget build(BuildContext context) {\n....\n    return MaterialApp(\n        ....\n        localeResolutionCallback: appLocaleResolutionCallback,\n    ....\n```\n\n### Formatting\nGet the result of formatting by using the class provided by flutter_ilib.\n\n```dart\nfinal ILibDateFmtOptions fmtOptions = ILibDateFmtOptions(\n    locale: 'ko-KR',\n    length: 'short',\n    useNative: false,\n    timezone: 'local');\nfinal ILibDateFmt fmt = ILibDateFmt(fmtOptions);\nfinal ILibDateOptions dateOptions = ILibDateOptions(\n    year: 2024,\n    month: 6,\n    day: 27,\n    hour: 13,\n    minute: 45,\n    second: 0,\n    millisecond: 0);\nfmt.format(dateOptions);\n// '24. 6. 27.'\n```\n\n```dart\nfinal ILibDateFmtOptions fmtOptions = ILibDateFmtOptions(\n    locale: 'ko-KR',\n    length: 'full',\n    type: 'datetime',\n    useNative: false,\n    timezone: 'local');\nfinal ILibDateFmt fmt = ILibDateFmt(fmtOptions);\nfinal ILibDateOptions dateOptions =\n    ILibDateOptions(dateTime: DateTime.parse('2024-06-27 10:42'));\nfmt.format(dateOptions);\n// '2024년 6월 27일 오전 10:42'\n```\n\n```dart\n// 0:sun, 1:mon, 2:tue, 3:wed, 4:thu, 5:fri, 6:sat\nfinal ILibLocaleInfo locInfo = ILibLocaleInfo('ko-KR');\nlocInfo.getFirstDayOfWeek();\n// 0\nlocInfo.getWeekEndStart();\n// 6\nlocInfo.getWeekEndEnd();\n// 0\n```\n\n## CLASS\n\n### FlutterILib\n- Methods: `evaluateILib()` :\n    It allows to use any class of APIs from ILib.   \n    Convert the Javascript code you want to get as a result into a string and pass it as an argument.\n```dart\nString lo = 'am-ET';\nString jscode1 = 'new LocaleInfo(\"$lo\").getCalendar()';\n_flutterIlibPlugin.evaluateILib(jscode1);\n// 'ethiopic'\n```\nTo give a more efficient way, we provide some classes that can be easily used in a Flutter app.   \nCurrently, We have a `ILibDateFmt` and `ILibLocaleInfo` classes.\nWe have a plan to provide more classes and methods.  \n\n### ILibDateFmt\n- Class: [ILibDateOptions](./Docs.md/#ilibdateoptions)\n- Class: [ILibDateFmtOptions](./Docs.md/#ilibdatefmtoptions)  \n- Class: [ILibDateFmt](./Docs.md#ilibdatefmt)\n   - Methods: `format()`, `getClock()`, `getTemplate()`, `getMeridiemsRange()`\n\n### ILibLocaleInfo\n- Class: [ILibLocaleInfo](./Docs.md/#iliblocaleinfo)\n   - Methods:  `getFirstDayOfWeek()`, `getWeekEndStart()`, `getWeekEndStart()` \n\n## Supported Locales\nThe results of the following locales are checked by unit tests.  \nThey have the same result as the original iLib methods.\n\n```text\naf-ZA,am-ET,ar-AE,ar-EG,ar-IQ,ar-MA,ar-SA,as-IN,az-Latn-AZ,bg-BG,bn-IN,    \nbs-Latn-BA,bs-Latn-ME,cs-CZ,da-DK,de-AT,de-CH,de-DE,de-LU,el-CY,el-GR, \nen-AM,en-AU,en-AZ,en-CA,en-CN,en-GB,en-GE,en-GH,en-HK,en-IE,en-IN,en-IS,  \nen-JP,en-KE,en-LK,en-MM,en-MW,en-MX,en-MY,en-NG,en-NZ,en-PH,en-PR,en-SG,  \nen-TW,en-UG,en-US,en-ZA,en-ZM,es-AR,es-BO,es-CA,es-CL,es-CO,es-DO,es-EC,  \nes-ES,es-GT,es-HN,es-MX,es-NI,es-PA,es-PE,es-PR,es-PY,es-SV,es-US,es-UY,  \nes-VE,et-EE,fa-IR,fi-FI,fr-BE,fr-CA,fr-CH,fr-FR,fr-LU,ga-IE,gu-IN,ha-Latn-NG,  \nhe-IL,hi-IN,hr-HR,hr-ME,hu-HU,id-ID,is-IS,it-CH,it-IT,ja-JP,kk-Cyrl-KZ,km-KH,  \nkn-IN,ko-KR,ko-US,ku-Arab-IQ,lt-LT,lv-LV,mk-MK,ml-IN,mn-Cyrl-MN,mr-IN,ms-MY,  \nnb-NO,nl-BE,nl-NL,or-IN,pa-IN,pl-PL,pt-BR,pt-PT,ro-RO,ru-BY,ru-GE,ru-KG,ru-KZ,  \nru-RU,ru-UA,si-LK,sk-SK,sl-SI,sq-AL,sq-ME,sr-Latn-ME,sr-Latn-RS,sv-FI,sv-SE,  \nsw-Latn-KE,ta-IN,te-IN,th-TH,tr-AM,tr-AZ,tr-CY,tr-TR,uk-UA,ur-IN,uz-Latn-UZ,  \nvi-VN,zh-Hans-CN,zh-Hant-HK,zh-Hant-TW\n```\n\n## Supported Platforms\n* Linux\n* webOS\n\n## TEST\n### Run the Unit Test\nOn Linux, you need to export an environment variable called `LIBQUICKJSC_TEST_PATH` pointing to the file `libquickjs_c_bridge_plugin.so`.\n\n```\nexport LIBQUICKJSC_TEST_PATH=\"${PWD}/test/linux/libquickjs_c_bridge_plugin.so\"\nflutter test test/flutter_ilib_test.dart\n```\nWe have the script file for the above works to do everything at once.\n\n```\n./execute_unit_test.sh\n```\n\u003e **Note**  \n\u003e Logging behavior has been updated and logs are printed by default during tests.  \n\u003e To suppress verbose logs during testing, add `--dart-define=TEST_MODE=true` option.  \n\u003e In this mode, only logs with **warning level or higher** will be printed.\n\n### Excute the example\nWe provide the example app that can be executed.\n```\ncd example\nflutter build linux --release\nflutter run -d linux --release\n```\n![image](./flutterilibExample.png)\n\n## License\n\nCopyright (c) 2024-2026, JEDLSoft\n\nThis plugin is license under Apache2. See the [LICENSE](./LICENSE)\nfile for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filib-js%2Fflutter_ilib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filib-js%2Fflutter_ilib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filib-js%2Fflutter_ilib/lists"}