smartnsoft / FlappyTranslator

A tool which automatically generates Flutter localization resources from CSV and Excel files.
MIT License
58 stars 19 forks source link

How about language code like en-us, en-gb, en-ca, and other? #17

Closed wahello closed 4 years ago

wahello commented 4 years ago

English has many kind, such as en-us, en-gb, en-ca, etc. And Chinese has zh-han zh-hant, etc.

flutter pub run flappy_translator result is error.

Unhandled exception:
Could not format because the source could not be parsed:

line 15, column 34: Expected to find ';'.
   ╷
15 │       static Map<String, String> _zh-cnValues = {
   │                                  ^^^
   ╵
line 15, column 37: Operator declarations must be preceded by the keyword 'operator'.
   ╷
15 │       static Map<String, String> _zh-cnValues = {
   │                                     ^
   ╵
line 15, column 37: Methods must have an explicit list of parameters.
   ╷
15 │       static Map<String, String> _zh-cnValues = {
   │                                     ^
   ╵
line 15, column 38: A function body must be provided.
   ╷
15 │       static Map<String, String> _zh-cnValues = {
   │                                      ^^^^^^^^
   ╵
line 15, column 38: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
   ╷
15 │       static Map<String, String> _zh-cnValues = {
   │                                      ^^^^^^^^
   ╵
line 18, column 34: Expected to find ';'.
   ╷
18 │       static Map<String, String> _zh-twValues = {
   │                                  ^^^
   ╵
line 18, column 37: Operator declarations must be preceded by the keyword 'operator'.
   ╷
18 │       static Map<String, String> _zh-twValues = {
   │                                     ^
   ╵
line 18, column 37: Methods must have an explicit list of parameters.
   ╷
18 │       static Map<String, String> _zh-twValues = {
   │                                     ^
   ╵
line 18, column 38: A function body must be provided.
   ╷
18 │       static Map<String, String> _zh-twValues = {
   │                                      ^^^^^^^^
   ╵
line 18, column 38: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
   ╷
18 │       static Map<String, String> _zh-twValues = {
   │                                      ^^^^^^^^
   ╵
#0      ErrorListener.throwIfErrors (package:dart_style/src/error_listener.dart:28:5)
#1      DartFormatter.formatSource (package:dart_style/src/dart_formatter.dart:149:19)
#2      DartFormatter.format (package:dart_style/src/dart_formatter.dart:76:12)
#3      FlappyTranslator._writeInFile (package:flappy_translator/flappy_translator.dart:153:32)
#4      FlappyTranslator.generate (package:flappy_translator/flappy_translator.dart:146:5)
#5      main (file:///Users/keyeMyria/.pub-cache/hosted/pub.flutter-io.cn/flappy_translator-1.2.2/bin/flappy_translator.dart:58:20)
#6      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#7      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
defuncart commented 4 years ago

@wahello The correct syntax to use is en_US, en_GB etc. Documentation and example.

defuncart commented 4 years ago

Closing as documentation wasn't followed correctly. Added #28 as a low priority enhancement.