diff --git a/.analysis_options b/.analysis_options new file mode 100644 index 0000000..fd0d392 --- /dev/null +++ b/.analysis_options @@ -0,0 +1,16 @@ +# ------------------------------------------------------------------------------ +# Config for Analyzer +# More: https://pub.dartlang.org/packages/analyzer +# +# Analyzer options: +# https://www.dartlang.org/guides/language/analysis-options +# + +analyzer: + strong-mode: true + + # Exclude wegen https://github.com/dart-lang/sdk/issues/26420 + # und https://github.com/dart-lang/test/issues/436 + + # exclude: + # - test/** diff --git a/README.md b/README.md index 8de54bd..2551a9e 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,45 @@ l10n / (gettext-oriented) PO-File Generator ------------------------------------------- -####Helps to localize your application#### +> Helps to localize your application -[![Screenshot][1])](http://www.youtube.com/watch?v=vPfl-xPTjs0) +#### Install +```bash +$ pub global activate l10n +``` -###Install - WORKS### +### System requirements +* xgettext +* msginit +* msgmerge + +(only if you want to generate PO/POT files) -```yaml -dependencies: - ... - l10n: any +To verify it they are on your system type: +```bash + $ type xgettext ``` - +If you get an error message - do the following: ```bash -pub update -ln -s packages/l10n/mkl10nlocale.dart mkl10nlocale - -mkl10nlocale --help + $ brew install gettext + # on Linux: apt-get install gettext ``` -####Install (should work)#### -In Dart(-sdk) 1.6 +Edit ~/.bashrc and add: ```bash -$ pub global activate l10n + # mkl10nlocale + export PATH=${PATH}:/usr/local/opt/gettext/bin ``` -should works... - BUT DOES NOT!!!! -You can run the script from any local directory. +To activate your settings: ```bash -$ pub global run l10n:mkl10nlocale --help + $ source ~/.bashrc ``` -pub global activate + run seams not ready! As said - make a symlink and you are done! -###How to use it### +### How to use it +[![Screenshot][1])](http://www.youtube.com/watch?v=vPfl-xPTjs0) +(You have to watch it in 1080p - sorry! Better screencast will follow) +**Sample code** ```dart import 'package:intl/intl.dart'; import 'package:intl/intl_standalone.dart'; @@ -80,7 +86,7 @@ SystemLocale: de_AT Dies ist ein TEST! ``` -###How to use it with AngularDart### +### How to use it with AngularDart - Write your Filter for Angular ```dart @@ -158,7 +164,7 @@ class SampleModule extends Module { ``` -####Sub-Translations### +#### Sub-Translations Since 0.11.0 Sub-Translations are possible - here is the explanation: ``` @@ -198,26 +204,18 @@ locale/en/.../messages.po: You have to add the msgid "Servermessage {{statuscode-400}}." by hand to your POT-File.
The rest is done be the nice merging-feature of l10n/msgmerge -###System requirements### -* xgettext -* msginit -* msgmerge - -These programs are on your system if you are working on Mac or Linux. - -(only if you want to generate PO/POT files) -###If you have problems### +### If you have problems * [Issues][2] -###History ### +### History * 0.15.12 - toJson converts vars not to "encodable" values * 0.11.0 - Sub-Translations are possible, msginit gets initialized with utf-8 per default * 0.9.0 - Released on pub -###License### +### License - Copyright 2014 Michael Mitterer (office@mikemitterer.at), + Copyright 2016 Michael Mitterer (office@mikemitterer.at), IT-Consulting and Development Limited, Austrian Branch Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/lib/mkl10nlocale.dart b/bin/mkl10nlocale.dart similarity index 99% rename from lib/mkl10nlocale.dart rename to bin/mkl10nlocale.dart index edc9d0f..ac79312 100755 --- a/lib/mkl10nlocale.dart +++ b/bin/mkl10nlocale.dart @@ -203,8 +203,9 @@ class Application { return true; - }).any((final File file) { - //_logger.fine(" Found: ${file}"); + }).map((final FileSystemEntity entity) => new File(entity.path)) + .forEach((final File file) { + _logger.fine(" Found: ${file}"); callback(file); }); } diff --git a/ex.sh b/ex.sh deleted file mode 100644 index 53f5007..0000000 --- a/ex.sh +++ /dev/null @@ -1 +0,0 @@ -Hallo \ No newline at end of file diff --git a/lib/src/l10n/L10NImpl.dart b/lib/src/l10n/L10NImpl.dart index c5eee84..e48da7c 100644 --- a/lib/src/l10n/L10NImpl.dart +++ b/lib/src/l10n/L10NImpl.dart @@ -56,7 +56,7 @@ class L10NImpl implements L10N { } Map toJson() { - final Map map = new Map(); + final Map map = new Map(); Map convertVarsToEncodableValues(final Map vars) { final Map encodableVars = new Map(); @@ -95,10 +95,10 @@ class L10NImpl implements L10N { Validate.notNull(data); if(data is Map) { - return data; + return data as Map; } else if(data is String) { - return JSON.decode(data); + return JSON.decode(data) as Map; } throw new ArgumentError("$data is not a valid basis for a JSON-Map. Data should be either a String or a Map but was ${data.runtimeType}"); diff --git a/mkl10nlocale b/mkl10nlocale deleted file mode 120000 index 9fba45a..0000000 --- a/mkl10nlocale +++ /dev/null @@ -1 +0,0 @@ -lib/mkl10nlocale.dart \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index ae1bb02..45003e0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -6,7 +6,7 @@ packages: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "0.27.2" + version: "0.29.0" ansicolor: description: name: ansicolor @@ -18,19 +18,19 @@ packages: name: args url: "https://pub.dartlang.org" source: hosted - version: "0.13.4+2" + version: "0.13.7" async: description: name: async url: "https://pub.dartlang.org" source: hosted - version: "1.11.0" + version: "1.11.3" barback: description: name: barback url: "https://pub.dartlang.org" source: hosted - version: "0.15.2+8" + version: "0.15.2+9" boolean_selector: description: name: boolean_selector @@ -49,30 +49,24 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" - cli_util: - description: - name: cli_util - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.1+2" collection: description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.9.0" + version: "1.9.1" console_log_handler: description: name: console_log_handler url: "https://pub.dartlang.org" source: hosted - version: "0.2.1" + version: "0.2.3" convert: description: name: convert url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.1" crypto: description: name: crypto @@ -84,7 +78,7 @@ packages: name: csslib url: "https://pub.dartlang.org" source: hosted - version: "0.13.2" + version: "0.13.2+1" glob: description: name: glob @@ -96,37 +90,49 @@ packages: name: grinder url: "https://pub.dartlang.org" source: hosted - version: "0.8.0+2" + version: "0.8.0+3" html: description: name: html url: "https://pub.dartlang.org" source: hosted - version: "0.12.2+2" + version: "0.13.0" + http: + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.3+9" http_multi_server: description: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" http_parser: description: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.0.3" intl: description: name: intl url: "https://pub.dartlang.org" source: hosted version: "0.14.0" + isolate: + description: + name: isolate + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.3" logging: description: name: logging url: "https://pub.dartlang.org" source: hosted - version: "0.11.3" + version: "0.11.3+1" logging_handlers: description: name: logging_handlers @@ -139,6 +145,12 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.0+2" + meta: + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" mime: description: name: mime @@ -156,19 +168,25 @@ packages: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "1.0.0" + package_resolver: + description: + name: package_resolver + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" path: description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.3.9" + version: "1.4.0" plugin: description: name: plugin url: "https://pub.dartlang.org" source: hosted - version: "0.1.0" + version: "0.2.0" pool: description: name: pool @@ -186,7 +204,13 @@ packages: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "0.6.5+2" + version: "0.6.7+1" + shelf_packages_handler: + description: + name: shelf_packages_handler + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" shelf_static: description: name: shelf_static @@ -204,25 +228,25 @@ packages: name: source_map_stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.3" source_maps: description: name: source_maps url: "https://pub.dartlang.org" source: hosted - version: "0.10.1+1" + version: "0.10.1+2" source_span: description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.2.3" + version: "1.3.0" stack_trace: description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.6.6" + version: "1.7.0" stream_channel: description: name: stream_channel @@ -234,7 +258,7 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" supports_color: description: name: supports_color @@ -246,7 +270,7 @@ packages: name: test url: "https://pub.dartlang.org" source: hosted - version: "0.12.15+1" + version: "0.12.15+12" typed_data: description: name: typed_data @@ -276,30 +300,18 @@ packages: name: watcher url: "https://pub.dartlang.org" source: hosted - version: "0.9.7+2" + version: "0.9.7+3" web_socket_channel: description: name: web_socket_channel url: "https://pub.dartlang.org" source: hosted version: "1.0.4" - when: - description: - name: when - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0" - which: - description: - name: which - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.3" yaml: description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.1.10" + version: "2.1.12" sdks: - dart: ">=1.17.0-dev.6.2 <1.20.0" + dart: ">=1.19.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index f9e31eb..b9f8397 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,6 +8,13 @@ homepage: https://github.com/MikeMitterer/dart-l10n-gettext environment: sdk: '>=1.12.0 <2.0.0' +# Add the bin/mkl10nlocale.dart script to the scripts pub installs. +# Activate local repo: +# pub global activate --source path . +# +executables: + mkl10nlocale: + dependencies: browser: ^0.10.0 diff --git a/tool/grind.dart b/tool/grind.dart index 2ac1c38..572deb5 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -1,6 +1,6 @@ import 'package:grinder/grinder.dart'; -main(args) => grind(args); +main(final List args) => grind(args); @Task() @Depends(testUnit)