Inscriber
Inscriber is an automation tool for pulling localized data from your database and creating a YAML file for translations. In particular this should work very well with the Globalize gem and Transifex company.
Installation
gem install inscriber
Or if you are using rails
gem 'inscriber'
Configuration
Inscriber starts with a config YAML file inscriber.yml
, example below:
adapter: 'postgres'
host: 'localhost'
port: 5432
database_name: 'test'
source_lang: 'en'
output_dir: 'tmp'
input_dir: 'tmp'
file_name: 'test'
tables:
- name: 'test_header_translations'
columns:
- body
- test_header_id
locales:
- fr
- ja
-
adapter : supports
postgres
,mysql
, &sqlite
-
host : host of the database, defaults to
127.0.0.1
-
port : port of the database, defaults to
5432
- database_name : name of the database
-
source_lang : the language that will serve as your basis for translations, defaults to
en
- output_dir : the directory you want Inscriber to export the database data, defaults to tmp directory
- input_dir : the directory you want Inscriber to read the translated files, defaults to tmp directory
-
file_name : the name of the yml you want to save from the database (exclude yml extension, this will be added), defaults to
translations
- tables : the names and columns of all data you want to be pulled from the database (include any required attributes in the column array)
- locales : the locales you are going to translate to in Transifex (this must match up with Transifex)
Setting the config path
Inscriber needs to know where to access the config path. By default this is set to config/inscriber.yml
. If you chose to change this, you can export or set an ENV
variable:
export INSCRIBER_CONFIG='/path/to/yml/file'
Usage
Inscriber was created for usage in small scripts or tasks.
Exporting
require 'inscriber'
Inscriber.export
Inserting
require 'inscriber'
Inscriber.insert
Running Tests
Inscriber uses RSpec test framework bundle exec rspec
Authors
This project is maintained by Ian Florentino
Credit
Inscriber was largely inspired and based off of Txdb