lang_table 0.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 81

lang_table #

lang_table is a dart plugin to generate string files from a source. Use a table to manage all multi-language resources. Inspired by fetch-mobile-localization-from-airtable

Installation #

Add this library into pubspec.yaml

    lang_table: 0.2.0

Usage #

Run the following command at root directory.Then will generate several output files based on the source platform

pub run lang_table:generate

A below table shown all supported arguments:

--platform(Required) The platform stores all localization strings. Suppoted platforms: airTable
--input(Required) The source of the strings
--target(Required) Code generator for a target plaformat. Supported target: Flutter
--output-dir(Optional) An output folder stores all generated json files (defaults to "res/string")
--api-key(Optional) Usage of platform specific

Example #

Key [code=key]English [code=en]Traditional Chinese [code=zh_TW]Japanese [code=ja]
simpleMessageThis is a simple Message這是簡單消息これは簡単なメッセージです
messageWithParamsHi ${yourName}, Welcome you!你好 ${yourName},歡迎你。こんにちは${yourName}、ようこそ。
group.helloWelcome you!歡迎你。ようこそ。

Example Template on AirTable

Running the following command,

pub run lang_table:generate --platform=airTable --input= --api-key={YOUR API KEY} --target=Flutter

Generated files like this,

|--- lib 
|--- res 
    |--- string 
         |--- string_en.json 
         |--- string_zh_TW.json 
         |--- string_ja.json 

Meta Code #

It is required to insert into table headers for identifying the usage of a table's column.

Type of Meta Code #

[code=key]Used to identify the column storing a key for a message
[code={Locale}]Used to identify the column storing a message for a specific language

Grouping Key #

For the key in [code=key], lang_table support group key. Using '.' to separate different groups


    "group.hello": "Welcome you!" 

Supported Platforms #

AirTable #


pub run lang_table:generate --platform=airTable --input= --api-key={YOUR API KEY} --target=Flutter

0.2.0 #

Features #

  • Support grouping key

0.1.1 #

Fix #

  • Remove print logs
  • Fix to get error for calling AirTable API

0.1.0 #

Feature #

  • Support AirTable to manage strings
  • Support to generate json files for Flutter


lang_table_example #

Demonstrates how to use the lang_table plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  lang_table: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:lang_table/lang_table.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health issues and suggestions

Document public APIs. (-1 points)

18 out of 18 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/print_tool.dart. (-1.49 points)

Analysis of lib/src/print_tool.dart reported 3 hints:

line 6 col 17: Unnecessary new keyword.

line 12 col 17: Unnecessary new keyword.

line 18 col 17: Unnecessary new keyword.

Fix bin/generate.dart. (-0.50 points)

Analysis of bin/generate.dart reported 1 hint:

line 63 col 16: Unnecessary new keyword.

Fix lib/src/generator/airtable_generator.dart. (-0.50 points)

Analysis of lib/src/generator/airtable_generator.dart reported 1 hint:

line 39 col 12: Use isNotEmpty instead of length

Fix additional 3 files with analysis or formatting issues. (-0.50 points)

Additional issues in the following files:

  • lib/src/json_builder.dart (1 hint)
  • lib/lang_table.dart (Run dartfmt to format lib/lang_table.dart.)
  • lib/src/extra_key_value.dart (Run dartfmt to format lib/src/extra_key_value.dart.)


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
ansicolor ^1.0.2 1.0.2
args >=0.12.1 <2.0.0 1.5.2
http ^0.12.0+2 0.12.0+4
path >=0.9.0 <2.0.0 1.6.4
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.8
pedantic 1.9.0
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6