lang_table 0.1.1

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

dev_dependencies: 
    lang_table: 0.1.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:

ArgumentDescription
--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]
localeEnglish中文日文
simpleMessageThis is a simple Message這是簡單消息これは簡単なメッセージです
messageWithParamsHi ${yourName}, Welcome you!你好 ${yourName},歡迎你。こんにちは${yourName}、ようこそ。

Example Template on AirTable

Running the following command,

pub run lang_table:generate --platform=airTable --input=https://api.airtable.com/v0/appZmh0WMg3y6APAg/example --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

Supported Platforms #

AirTable #

Example

pub run lang_table:generate --platform=airTable --input=https://api.airtable.com/v0/appZmh0WMg3y6APAg/example --api-key={YOUR API KEY} --target=Flutter

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

example/README.md

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:


dependencies:
  lang_table: ^0.1.1

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/base_platform_generator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

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/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 lib/src/json_builder.dart. (-0.50 points)

Analysis of lib/src/json_builder.dart reported 1 hint:

line 6 col 8: Unused import: 'package:lang_table/src/print_tool.dart'.

Format bin/generate.dart.

Run dartfmt to format bin/generate.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/base_platform_generator.dart (Run dartfmt to format lib/base_platform_generator.dart.)
  • lib/src/extra_key_value.dart (Run dartfmt to format lib/src/extra_key_value.dart.)
  • lib/src/print_tool.dart (Run dartfmt to format lib/src/print_tool.dart.)

Dependencies

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+2
path >=0.9.0 <2.0.0 1.6.4
Transitive dependencies
async 2.3.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.7
pedantic 1.8.0+1
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6