Code Monkey home page Code Monkey logo

localizable.excel.go's Introduction

A go (or 'golang' for search engine friendliness) implementation of localize strings render tool.

Edit text in Excel or formatted JSON/YAML and export to:

  • iOS strings
  • Android string.xml
  • Flutter arb json for intl_localization

Structure of Formatted JSON or YAML

- format: ios_string
  language_names: [en,ja,zh,zh-Hant]
  name: iOS
  path: Resources/Localizable
  translations:
    - [home.title,Text Editor,テキストエディタ,文字编辑,文字編輯]
	- [home.footer,Copyright]
- format: android
  path: app/src/main/res
  name: Android
  language_names: ["",en]
  translations:
    - [app_name,了不起的应用程序,Amazing App]
- format: arb
  ...

Structure of Excel

Each work sheet is a Localizabe.strings group:

  • Cell[0,0] should be -
path={PathToSaving}/{LocalizableFileName}
format=ios_strings|json|arb

Each argument separate with & or new line.

  • Other cells on row[0] should be language code, e.g. en, zh-Hans, it.

  • Other cells on column[0] should be strings key, what you typed in code - NSLocalizableString("StringKey", comment: nil).

|path=Resources/Localizable&format=ios|en|ja|zh|zh-Hant-HK |-|-|-| |home.title|Text Editor|テキストエディタ|文字编辑|文字編輯| |home.footer|Copyright|

path=app/src/main/res&format=android en
app_name 了不起的应用程序 Amazing App

Help

$ go run main.go

New formatted JSON / formatted YAML / xlsx

$ go run main.go new <file>

Convert between formatted JSON / formatted YAML / xlsx

$ go run main.go convert <input file> <output file>

Export

  • Command
$ go run main.go export <input file> <export dir>
  • format=ios

    • Resources/en.lproj/Localizable.strings
     home.title="Text Editor"
     home.footer="Copyright"
    
    • Resources/ja.lproj/Localizable.strings
     home.title="テキストエディタ"
    
  • format=android

    • app/src/main/res/value/strings.xml
     <?xml version="1.0" encoding="UTF-8"?>
     <resources>
     	<string name="app_name">了不起的应用程序</string>
     </resources>
    • app/src/main/res/value-en/strings.xml
     <?xml version="1.0" encoding="UTF-8"?>
     <resources>
     	<string name="app_name">Amazing App</string>
     </resources>
  • format=json

    • Resources/Localizable.json
     {
     	"keys":["home.title","home.footer"],
     	"text":{
     		"en":["Text Editor","Copyright"],
     		"ja":["テキストエディタ",""]
     	}
     }
  • format=arb

    • Resources/Localizabe.arb
     {"locales":["en","ja"]}
    • Resources/Localizabe_en.arb
     {"@@locale":"en","home.title":"Text Editor","home.footer":"Copyright"}
    • Resources/Localizabe_ja.arb
     {"@@locale":"ja","home.title":"テキストエディタ"}

Dependence

  • github.com/tealeg/xlsx
  • gopkg.in/yaml.v3

localizable.excel.go's People

Contributors

shawnclovie avatar

Watchers

 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.