Permalink
Browse files

doc: Grinder + new test-format

  • Loading branch information...
MikeMitterer committed Dec 4, 2015
1 parent fbcc399 commit f0fbeff3f2b5e24ffccdb077bd2cef75bfee3418
View
@@ -1,6 +1,5 @@
import 'package:intl/intl.dart';
import 'package:intl/intl_standalone.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:l10n/l10n.dart';
View
@@ -78,8 +78,7 @@ class Application {
}
}
on FormatException
catch (error) {
on FormatException {
_showUsage();
}
}
@@ -179,30 +178,6 @@ class Application {
return future;
}
/**
* Only for testing - I'm using the SYNC-Version because otherwise it bring xgettext into trouble
*/
void _iterateThroughDir(final String dir, void callback(final File file)) {
_logger.info("Scanning: $dir");
// its OK if the path starts with packages but not if the path contains packages (avoid recursion)
final RegExp regexp = new RegExp("^/*packages/*");
final Directory directory = new Directory(dir);
directory.exists().then((_) {
directory.list(recursive: true).where((final FileSystemEntity entity) {
return (FileSystemEntity.isFileSync(entity.path) && entity.path.contains(regexp) == false &&
( entity.path.endsWith(".dart") || entity.path.endsWith(".DART") || entity.path.endsWith(".html"))
);
}).any((final File file) {
callback(file);
});
}).catchError((final dynamic error, final StackTrace stacktrace) {
_logger.fine(error);
});
}
/// Goes through the files
void _iterateThroughDirSync(final String dir, void callback(final File file)) {
_logger.info("Scanning: $dir");
@@ -237,7 +212,7 @@ class Application {
void _showUsage() {
print(translate(l10n("Usage: mkl10nlocale [options] <dir(s) to scan>")));
_parser.getUsage().split("\n").forEach((final String line) {
_parser.usage.split("\n").forEach((final String line) {
print(" $line");
});
@@ -495,6 +470,6 @@ void main(List<String> arguments) {
});
/// only for testing
final L10N l1 = const L10N("Ein TEST - 290714 1648");
// final L10N l1 = const L10N("Ein TEST - 290714 1648");
}
@@ -118,14 +118,14 @@ class L10NTranslate extends Translator {
String message;
try {
final String verifiedLocale = Intl.verifiedLocale(locale,(final String testLocale) {
Intl.verifiedLocale(locale,(final String testLocale) {
if(_isKeyInTranslationTable(msgid,testLocale)) {
message = _translations[testLocale][msgid];
return true;
}
return false;
});
} on ArgumentError catch (error) {
} on ArgumentError {
if(_isKeyInTranslationTable(msgid,_DEFAULT_LOCALE)) {
message = _translations[_DEFAULT_LOCALE][msgid];
} else {
View
@@ -4,15 +4,19 @@ packages:
analyzer:
description: analyzer
source: hosted
version: "0.26.1+16"
version: "0.26.3"
ansicolor:
description: ansicolor
source: hosted
version: "0.0.9"
args:
description: args
source: hosted
version: "0.13.2"
async:
description: async
source: hosted
version: "1.3.0"
version: "1.4.0"
barback:
description: barback
source: hosted
@@ -25,18 +29,22 @@ packages:
description: charcode
source: hosted
version: "1.1.0"
cli_util:
description: cli_util
source: hosted
version: "0.0.1+2"
collection:
description: collection
source: hosted
version: "1.1.3"
version: "1.2.0"
console_log_handler:
description: console_log_handler
source: hosted
version: "0.1.4"
convert:
description: convert
source: hosted
version: "1.0.0"
version: "1.0.1"
crypto:
description: crypto
source: hosted
@@ -49,6 +57,10 @@ packages:
description: glob
source: hosted
version: "1.0.5"
grinder:
description: grinder
source: hosted
version: "0.8.0+1"
html:
description: html
source: hosted
@@ -81,14 +93,18 @@ packages:
description: mime
source: hosted
version: "0.9.3"
mockable_filesystem:
description: mockable_filesystem
source: hosted
version: "0.0.3"
package_config:
description: package_config
source: hosted
version: "0.1.3"
path:
description: path
source: hosted
version: "1.3.6"
version: "1.3.9"
petitparser:
description: petitparser
source: hosted
@@ -100,15 +116,15 @@ packages:
pool:
description: pool
source: hosted
version: "1.2.0"
version: "1.2.1"
pub_semver:
description: pub_semver
source: hosted
version: "1.2.2"
version: "1.2.3"
shelf:
description: shelf
source: hosted
version: "0.6.4"
version: "0.6.4+2"
shelf_static:
description: shelf_static
source: hosted
@@ -132,19 +148,27 @@ packages:
stack_trace:
description: stack_trace
source: hosted
version: "1.4.2"
version: "1.5.0"
string_scanner:
description: string_scanner
source: hosted
version: "0.1.4"
supports_color:
description: supports_color
source: hosted
version: "0.1.1"
test:
description: test
source: hosted
version: "0.12.5+1"
version: "0.12.6"
typed_data:
description: typed_data
source: hosted
version: "1.0.0"
version: "1.1.1"
unscripted:
description: unscripted
source: hosted
version: "0.6.2"
utf:
description: utf
source: hosted
@@ -157,6 +181,14 @@ packages:
description: watcher
source: hosted
version: "0.9.7"
when:
description: when
source: hosted
version: "0.2.0"
which:
description: which
source: hosted
version: "0.1.3"
yaml:
description: yaml
source: hosted
View
@@ -1,8 +1,13 @@
name: l10n
version: 0.15.12
author: Mike Mitterer <office@mikemitterer.at>
description: Creates translatable PO-Files, strong orientation to xgettext
homepage: https://github.com/MikeMitterer/dart-l10n-gettext
environment:
sdk: '>=1.12.0 <2.0.0'
dependencies:
browser: ^0.10.0
@@ -17,9 +22,7 @@ dependencies:
args: ^0.13.0
#dependency_overrides:
# analyzer: ">=0.21.1 <0.22.0"
dev_dependencies:
grinder: any
test: any
View

This file was deleted.

Oops, something went wrong.
@@ -1,7 +1,15 @@
part of unit.test;
@TestOn("content-shell")
import 'package:test/test.dart';
testL10NTranslation() {
final Logger _logger = new Logger("unit.test.L10NTranslation");
import 'package:logging/logging.dart';
import 'package:logging_handlers/logging_handlers_shared.dart';
import 'package:l10n/l10n.dart';
import 'package:l10n/locale/messages.dart';
main() {
// final Logger _logger = new Logger("unit.test.L10NTranslation");
configLogging();
final Map<String,Map<String,String>> translationTable = {
"en" : {
@@ -77,24 +85,24 @@ testL10NTranslation() {
expect(translator(l10n),"Willkommen in Australien Sarah");
}); // end of 'Translate with Table' test
test('> Locale', () {
final Intl intl = new Intl();
_logger.info(intl.locale);
_logger.info(Intl.shortLocale(intl.locale));
String result;
try {
result = Intl.verifiedLocale('ysdex',(final String testLocale) {
_logger.info("VL: $testLocale");
return false;
});
} on ArgumentError catch (error) {
result = "en";
}
}, skip: "Nur für Output interessant"); // end of 'Locale' test
// test('> Locale', () {
// final Intl intl = new Intl();
// _logger.info(intl.locale);
// _logger.info(Intl.shortLocale(intl.locale));
//
// String result;
//
// try {
// result = Intl.verifiedLocale('ysdex',(final String testLocale) {
// _logger.info("VL: $testLocale");
// return false;
// });
// } on ArgumentError {
// result = "en";
// }
//
//
// }, skip: "Nur für Output interessant"); // end of 'Locale' test
test('> With external table', () {
final L10NTranslate translate = new L10NTranslate.withTranslation(translationTable["en"]);
@@ -151,6 +159,8 @@ testL10NTranslation() {
// end 'L10NTranslation' group
}
//------------------------------------------------------------------------------------------------
// Helper
//------------------------------------------------------------------------------------------------
void configLogging() {
hierarchicalLoggingEnabled = false;
Logger.root.level = Level.INFO;
Logger.root.onRecord.listen(new LogPrintHandler());
}
@@ -1,4 +1,7 @@
part of unit.test;
@TestOn("content-shell")
import 'package:test/test.dart';
import 'package:l10n/l10n.dart';
class Name implements Translatable {
final String firstname;
@@ -10,9 +13,7 @@ class Name implements Translatable {
}
}
testL10N() {
final Logger _logger = new Logger("test.L10NMessage");
main() {
final String jsonToTest = "{\n" +
" \"msgid\" : \"Hallo {{name}}, du bist jetzt {{age}} Jahre alt\",\n" +
" \"vars\" :\n" +
@@ -114,7 +115,3 @@ testL10N() {
});
// end 'L10NMessage' group
}
//------------------------------------------------------------------------------------------------
// Helper
//------------------------------------------------------------------------------------------------
@@ -1,7 +1,12 @@
part of unit.test;
@TestOn("content-shell")
import 'package:test/test.dart';
testRegExp() {
final Logger _logger = new Logger("unit.test.RegExp");
import 'package:logging/logging.dart';
import 'package:logging_handlers/logging_handlers_shared.dart';
main() {
// final Logger _logger = new Logger("unit.test.RegExp");
configLogging();
group('RegExp', () {
setUp(() {
@@ -36,6 +41,8 @@ testRegExp() {
// end 'RegExp' group
}
//------------------------------------------------------------------------------------------------
// Helper
//------------------------------------------------------------------------------------------------
void configLogging() {
hierarchicalLoggingEnabled = false;
Logger.root.level = Level.INFO;
Logger.root.onRecord.listen(new LogPrintHandler());
}
Oops, something went wrong.

0 comments on commit f0fbeff

Please sign in to comment.