项目作者: mauriciotogneri
项目描述 :
Easy localization management tool using Google Spreadsheets.
高级语言: JavaScript
项目地址: git://github.com/mauriciotogneri/sheet-localization.git
Sheet Localization
Easy localization management tool using Google Spreadsheets.
Table of contents
Features
- Free
- Easy to setup
- Scalable
- Multi-user
- Customizable UI
- Version history built-in
- Android (.xml)
- iOS (.strings)
- iOS (.swift)
- JSON (plain)
- YAML (plain)
- XLIFF (v1.2)
- PHP Array
Installation
- Create an empty Google Spreadsheet
- Create a column for the keys and at least one language column. For example:
- Open the script editor: Tools ⟶ Script editor
- Copy the contents of script.gs and paste it inside of the empty file (usually named Code.gs) in the script editor
- In the last line of the script, edit the function
getToken()
and add your own randomly generated token - In the script editor, create a new HTML file by clicking on File ⟶ New ⟶ HTML file and call it import (without extension)
- Copy the contents of import.html and paste it in the newly created file
- Perform the same operation with the file info.html
- Deploy the tool by clicking on Publish ⟶ Deploy as web app… in the script editor
- In the form, select the following values:
- Project version: New
- Execute the app as: Me
- Who has access to the app: Anyone, even anonymous
- Click on Deploy
- Reload the Spreadsheet in the browser (the script editor will close automatically as a result)
- Check that a new menu entry (Localization) appeared in the toolbar
Upgrade
If you already have the tool and you want to upgrade it to the latest version:
- Open the script editor: Tools ⟶ Script editor
- Replace the contents of the following files:
- Deploy the tool by clicking on Publish ⟶ Deploy as web app… in the script editor
- In the form, select the following values:
- Project version: New
- Execute the app as: Me
- Who has access to the app: Anyone, even anonymous
- Click on Deploy
Constraints
Sheet
- The first sheet must contain the keys and translations
- The tool can use one spreadsheet per project
Keys
- Cannot be empty
- Must start with a letter
- Must be unique
- The header can have any text
Translations
- Can be empty (i.e. untranslated)
- Headers must have the following pattern:
Name (locale)
. For example: English (en)
Parameters
Parameters inside of translations must be declared as {index$format}
, where:
index
: the position of the parameter in the text (starting from 1)format
: the format of the parameter
Formats available:
s
(string)d
(integer)f
(decimal)
Example of localization table
Keys |
English (en) |
Spanish (es) |
hello.world |
Hello, world! |
¡Hola, mundo! |
welcome |
Welcome, {1$s}! |
¡Bienvenido, {1$s}! |
total_cost |
The total cost is: {1$f} USD |
El coste total es: {1$f} USD |
appointment |
Your appointment is on {1$s} at {2$s} |
Su cita es el {1$s} a las {2$s} |
Import
- Click on Localization ⟶ Import
- Select the language and format of the input
- If replace values is enabled, the content will be replaced if the keys match
- Paste the content of the file in the input field
- Click on Import
Export
- Download the script to pull the localization files
- Change the values of the variables
LOCALE
and FORMAT
to adapt to your needs - Click on Localization ⟶ Info to obtain the values of
URL
and TOKEN
- Run the script to download the localization file
Formats available:
android
ios
swift
json
yaml
xliff
php
Statistics
The tool can gather some general statistics about the content. To access it, click on Localization ⟶ Info. The table shows 2 values for each language:
- Translated: A cell counts as translated if it’s not empty
- Validated: A cell counts as validated if its background color is different than
#ffffff
It’s recommended to assign a background color to a non validated translation to keep track of them
Best practices
- Limit the access to columns only to users that should edit them
TODO
- Support more formats:
- INI
- Properties
- Angular translate
- Gettext
- Twine