Skip to content

Commit

Permalink
doc: Strong-Mode support, README improved
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMitterer committed Nov 16, 2016
1 parent 5df6107 commit 5532669
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 86 deletions.
16 changes: 16 additions & 0 deletions .analysis_options
Original file line number Diff line number Diff line change
@@ -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/**
66 changes: 32 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -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... - <b>BUT DOES NOT!!!!</b>

You can run the script from any local directory.
To activate your settings:
```bash
$ pub global run l10n:mkl10nlocale --help
$ source ~/.bashrc
```
<b>pub global activate + run seams not ready!</b> 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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -158,7 +164,7 @@ class SampleModule extends Module {
</div>
```

####Sub-Translations###
#### Sub-Translations
Since 0.11.0 Sub-Translations are possible - here is the explanation:

```
Expand Down Expand Up @@ -198,26 +204,18 @@ locale/en/.../messages.po:
You have to add the msgid "Servermessage {{statuscode-400}}." by hand to your <strong>POT</strong>-File.<br>
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");
Expand Down
5 changes: 3 additions & 2 deletions lib/mkl10nlocale.dart → bin/mkl10nlocale.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
Expand Down
1 change: 0 additions & 1 deletion ex.sh

This file was deleted.

6 changes: 3 additions & 3 deletions lib/src/l10n/L10NImpl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class L10NImpl implements L10N {
}

Map<String, dynamic> toJson() {
final Map map = new Map<String, dynamic>();
final Map<String, dynamic> map = new Map<String, dynamic>();

Map<String,dynamic> convertVarsToEncodableValues(final Map<String,dynamic> vars) {
final Map<String,dynamic> encodableVars = new Map<String, dynamic>();
Expand Down Expand Up @@ -95,10 +95,10 @@ class L10NImpl implements L10N {
Validate.notNull(data);

if(data is Map) {
return data;
return data as Map<String, dynamic>;

} else if(data is String) {
return JSON.decode(data);
return JSON.decode(data) as Map<String, dynamic>;
}

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}");
Expand Down
1 change: 0 additions & 1 deletion mkl10nlocale

This file was deleted.

Loading

0 comments on commit 5532669

Please sign in to comment.