Permalink
Browse files

doc: cmdline-Sample added

  • Loading branch information...
MikeMitterer committed Dec 6, 2017
1 parent 0a7322b commit 512d28cd07cfee29511a965214220f6c9a51460e
Showing with 242 additions and 94 deletions.
  1. +2 −2 bin/mkl10n.dart
  2. 0 {samples → examples}/cmdline/.mkl10n.yaml
  3. 0 {samples → examples}/cmdline/CHANGELOG.md
  4. 0 {samples → examples}/cmdline/LICENSE
  5. 0 {samples → examples}/cmdline/README.md
  6. +8 −0 {samples → examples}/cmdline/bin/cmdline.dart
  7. 0 {samples → examples}/cmdline/lib/cmdline.dart
  8. 0 {samples → examples}/cmdline/lib/cmdline/Application.dart
  9. 0 {samples → examples}/cmdline/lib/cmdline/Config.dart
  10. +9 −6 {samples → examples}/cmdline/lib/cmdline/Options.dart
  11. +37 −0 examples/cmdline/lib/locale/messages.dart
  12. +14 −0 examples/cmdline/locale/de/LC_MESSAGES/messages.json
  13. +22 −2 {samples → examples}/cmdline/locale/de/LC_MESSAGES/messages.po
  14. +14 −0 examples/cmdline/locale/en/LC_MESSAGES/messages.json
  15. +60 −0 examples/cmdline/locale/en/LC_MESSAGES/messages.po
  16. +26 −0 examples/cmdline/locale/messages.json
  17. +26 −1 {samples → examples}/cmdline/locale/templates/LC_MESSAGES/messages.gettext.pot
  18. +21 −2 {samples → examples}/cmdline/locale/templates/LC_MESSAGES/messages.pot
  19. 0 {samples → examples}/cmdline/locale/templates/potheader.tpl
  20. +0 −1 {samples → examples}/cmdline/pubspec.yaml
  21. 0 {samples → examples}/web/index.html
  22. +0 −20 samples/cmdline/lib/locale/messages.dart
  23. +0 −9 samples/cmdline/locale/de/LC_MESSAGES/messages.json
  24. +0 −9 samples/cmdline/locale/messages.json
  25. +0 −35 test/unit/config.dart
  26. +1 −1 test/unit/l10n/L10NTranslation_test.dart
  27. +1 −2 test/unit/parser/Parser_test.dart
  28. +1 −4 test/unit/regexp/RegExp_test.dart
View
@@ -16,7 +16,7 @@ import 'package:intl/intl_standalone.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:logging/logging.dart';
import 'package:logging_handlers/logging_handlers_shared.dart';
import 'package:console_log_handler/print_log_handler.dart';
import 'package:l10n/l10n.dart';
import 'package:l10n/locale/messages.dart';
@@ -390,7 +390,7 @@ class Application {
Logger.root.level = Level.INFO;
}
Logger.root.onRecord.listen(new LogPrintHandler(messageFormat: "%m"));
Logger.root.onRecord.listen(logToConsole);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -20,6 +20,14 @@ Future main(List<String> arguments) async {
// For debugging
// print("SystemLocale: $locale"); // in my case: de_AT.UTF-8
// Only necessary for this sample
// Ignore the following 5 lines in real life
if(arguments.contains("-l")) {
translate.locale = arguments[arguments.indexOf("-l") + 1];
} else if(arguments.contains("--locale")) {
translate.locale = arguments[arguments.indexOf("--locale") + 1];
}
final Application application = new Application();
application.run( arguments, locale );
}
@@ -20,17 +20,19 @@ class Options {
}
void showUsage() {
print("Usage: $APPNAME [options]");
print(translate(l10n("Usage: cmdline [options]")));
_parser.usage.split("\n").forEach((final String line) {
print(" $line");
});
print("");
print("Sample:");
print(translate(l10n("Sample:")));
print("");
print(" 'Generates the static site in your 'web-folder': '$APPNAME -g'");
print(" 'Tests the loglevel-translation': '" +
translate(l10n("loglevel")) + "'");
print(" " + translate(l10n("Generates the static site in your 'web-folder':")).padRight(50)
+ "'$APPNAME -g'");
print(" " + translate(l10n("Tests the loglevel-translation:")).padRight(50)
+ "'$APPNAME -h'");
print("");
}
@@ -40,7 +42,8 @@ class Options {
static ArgParser _createParser() {
final ArgParser parser = new ArgParser()
..addFlag(_ARG_SETTINGS, abbr: 's', negatable: false, help: "Prints settings")
..addFlag(_ARG_SETTINGS, abbr: 's', negatable: false,
help: translate(l10n("Prints settings")))
..addOption(_ARG_LOCALE, abbr: 'l', help: "Set locale")
@@ -0,0 +1,37 @@
library l10n.locale;
/**
* DO NOT EDIT. This is code generated with:
* projectdir $ mkl10n .
*/
import 'package:l10n/l10n.dart';
final L10NTranslate translate = new L10NTranslate.withTranslations( {
"en": {
"Config file": "Config file",
"Config folder": "Config folder",
"Dirs to scan": "Dirs to scan",
"Generates the static site in your 'web-folder':": "",
"Locale": "Locale",
"loglevel": "loglevel",
"Prints settings": "",
"Sample:": "Sample:",
"Tests the loglevel-translation:": "",
"Usage: cmdline [options]": ""
},
"de": {
"Config file": "Konfigurationsfile",
"Config folder": "Konfigurationsordner",
"Dirs to scan": "Scan-Directories",
"Generates the static site in your 'web-folder':": "Erstellt die statische Seite im 'web-folder':",
"Locale": "",
"loglevel": "LL Translated",
"Prints settings": "Zeigt die settings an",
"Sample:": "Beispiel:",
"Tests the loglevel-translation:": "Testet die loglevel-Übersetzung:",
"Usage: cmdline [options]": "Verwendung: cmdline [optionen]"
}
});
@@ -0,0 +1,14 @@
{
"de": {
"Config file": "Konfigurationsfile",
"Config folder": "Konfigurationsordner",
"Dirs to scan": "Scan-Directories",
"Generates the static site in your 'web-folder':": "Erstellt die statische Seite im 'web-folder':",
"Locale": "",
"loglevel": "LL Translated",
"Prints settings": "Zeigt die settings an",
"Sample:": "Beispiel:",
"Tests the loglevel-translation:": "Testet die loglevel-Übersetzung:",
"Usage: cmdline [options]": "Verwendung: cmdline [optionen]"
}
}
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: L 10N4Dart\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-25 15:25\n"
"POT-Creation-Date: 2017-12-06 18:36\n"
"PO-Revision-Date: 2017-08-23 12:50+0200\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@@ -18,7 +18,7 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. Everything within l10n(...) will be in your .po File
#: lib/cmdline/Config.dart:41 lib/cmdline/Options.dart:32
#: lib/cmdline/Config.dart:41
msgid "loglevel"
msgstr "LL Translated"
@@ -39,3 +39,23 @@ msgstr ""
#: lib/cmdline/Config.dart:49
msgid "Dirs to scan"
msgstr "Scan-Directories"
#: lib/cmdline/Options.dart:23
msgid "Usage: cmdline [options]"
msgstr "Verwendung: cmdline [optionen]"
#: lib/cmdline/Options.dart:29
msgid "Sample:"
msgstr "Beispiel:"
#: lib/cmdline/Options.dart:31
msgid "Generates the static site in your 'web-folder':"
msgstr "Erstellt die statische Seite im 'web-folder':"
#: lib/cmdline/Options.dart:34
msgid "Tests the loglevel-translation:"
msgstr "Testet die loglevel-Übersetzung:"
#: lib/cmdline/Options.dart:46
msgid "Prints settings"
msgstr "Zeigt die settings an"
@@ -0,0 +1,14 @@
{
"en": {
"Config file": "Config file",
"Config folder": "Config folder",
"Dirs to scan": "Dirs to scan",
"Generates the static site in your 'web-folder':": "",
"Locale": "Locale",
"loglevel": "loglevel",
"Prints settings": "",
"Sample:": "Sample:",
"Tests the loglevel-translation:": "",
"Usage: cmdline [options]": ""
}
}
@@ -0,0 +1,60 @@
# English translations for L package.
# Copyright (C) 2017 THE L'S COPYRIGHT HOLDER
# This file is distributed under the same license as the L package.
# Automatically generated, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: L 10N4Dart\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-06 18:36\n"
"PO-Revision-Date: 2017-12-06 18:14\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. Everything within l10n(...) will be in your .po File
#: lib/cmdline/Config.dart:41
msgid "loglevel"
msgstr "loglevel"
#. 'translate' will translate your ID/String
#: lib/cmdline/Config.dart:44
msgid "Config folder"
msgstr "Config folder"
#: lib/cmdline/Config.dart:45
msgid "Config file"
msgstr "Config file"
#: lib/cmdline/Config.dart:46
msgid "Locale"
msgstr "Locale"
#: lib/cmdline/Config.dart:49
msgid "Dirs to scan"
msgstr "Dirs to scan"
#: lib/cmdline/Options.dart:23
msgid "Usage: cmdline [options]"
msgstr ""
#: lib/cmdline/Options.dart:29
msgid "Sample:"
msgstr "Sample:"
#: lib/cmdline/Options.dart:31
msgid "Generates the static site in your 'web-folder':"
msgstr ""
#: lib/cmdline/Options.dart:34
msgid "Tests the loglevel-translation:"
msgstr ""
#: lib/cmdline/Options.dart:46
msgid "Prints settings"
msgstr ""
@@ -0,0 +1,26 @@
{
"en": {
"Config file": "Config file",
"Config folder": "Config folder",
"Dirs to scan": "Dirs to scan",
"Generates the static site in your 'web-folder':": "",
"Locale": "Locale",
"loglevel": "loglevel",
"Prints settings": "",
"Sample:": "Sample:",
"Tests the loglevel-translation:": "",
"Usage: cmdline [options]": ""
},
"de": {
"Config file": "Konfigurationsfile",
"Config folder": "Konfigurationsordner",
"Dirs to scan": "Scan-Directories",
"Generates the static site in your 'web-folder':": "Erstellt die statische Seite im 'web-folder':",
"Locale": "",
"loglevel": "LL Translated",
"Prints settings": "Zeigt die settings an",
"Sample:": "Beispiel:",
"Tests the loglevel-translation:": "Testet die loglevel-Übersetzung:",
"Usage: cmdline [options]": "Verwendung: cmdline [optionen]"
}
}
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-25 15:25+0200\n"
"POT-Creation-Date: 2017-12-06 18:36+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -22,6 +22,7 @@ msgstr ""
#. Everything within l10n(...) will be in your .po File
#: lib/cmdline/Config.dart:41 lib/cmdline/Options.dart:29
#: lib/cmdline/Options.dart:32 lib/cmdline/Options.dart:33
#: lib/cmdline/Options.dart:35
msgid "loglevel"
msgstr ""
@@ -41,3 +42,27 @@ msgstr ""
#: lib/cmdline/Config.dart:49
msgid "Dirs to scan"
msgstr ""
#: lib/cmdline/Options.dart:23
msgid "Usage: $APPNAME [options]"
msgstr ""
#: lib/cmdline/Options.dart:23
msgid "Usage: cmdline [options]"
msgstr ""
#: lib/cmdline/Options.dart:29
msgid "Sample:"
msgstr ""
#: lib/cmdline/Options.dart:31
msgid "Generates the static site in your 'web-folder':"
msgstr ""
#: lib/cmdline/Options.dart:34
msgid "Tests the loglevel-translation:"
msgstr ""
#: lib/cmdline/Options.dart:45 lib/cmdline/Options.dart:46
msgid "Prints settings"
msgstr ""
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-25 15:25\n"
"POT-Creation-Date: 2017-12-06 18:36\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,7 +18,6 @@ msgstr ""
#. Everything within l10n(...) will be in your .po File
#: ./lib/cmdline/Config.dart:41
#: ./lib/cmdline/Options.dart:32
msgid "loglevel"
msgstr ""
@@ -39,3 +38,23 @@ msgstr ""
msgid "Dirs to scan"
msgstr ""
#: ./lib/cmdline/Options.dart:23
msgid "Usage: cmdline [options]"
msgstr ""
#: ./lib/cmdline/Options.dart:29
msgid "Sample:"
msgstr ""
#: ./lib/cmdline/Options.dart:31
msgid "Generates the static site in your 'web-folder':"
msgstr ""
#: ./lib/cmdline/Options.dart:34
msgid "Tests the loglevel-translation:"
msgstr ""
#: ./lib/cmdline/Options.dart:46
msgid "Prints settings"
msgstr ""
@@ -21,7 +21,6 @@ dependencies:
browser: any
logging: any
logging_handlers: any
console_log_handler: any
validate: any
File renamed without changes.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 512d28c

Please sign in to comment.