Giter VIP home page Giter VIP logo

k00na / lang_table Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kingwu/lang_table

0.0 0.0 0.0 68 KB

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

License: BSD 2-Clause "Simplified" License

Dart 85.44% Kotlin 1.41% Ruby 9.17% Swift 1.66% Objective-C 0.15% Shell 2.16%

lang_table's Introduction

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.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:

Argument Description
--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]
locale English 中文 日文
simpleMessage This is a simple Message 這是簡單消息 これは簡単なメッセージです
messageWithParams Hi ${yourName}, Welcome you! 你好 ${yourName},歡迎你。 こんにちは${yourName}、ようこそ。
group.hello Welcome you! 歡迎你。 ようこそ。

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

Grouping Key

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

eg.

{
    "group.hello": "Welcome you!" 
}

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

lang_table's People

Contributors

k00na avatar kingwu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.