A Sinatra server that integrates Transifex with GitHub
+- app
|
+- app.rb # the main Sinatra app, includes both web service endpoints
|
+- config
|
+- key_manager.rb # library responsible for loading config
|
+- tx.config # this is the Transifex flavored resource map file
|
+- txgh.yml # this is the main application configuration
|
+- lib # all the libraries
|
+ ...
+- tests # rack/test integration tests
|
+ ...
|
+- Rakefile # bootstrap for TravisCI
|
+- bootstrap.rb # includes for application paths
|
+- config.ru bootstrap for Sinatra
You configure a service hook in Github and point it to this server. The URL path to the service hook endpoint: /hooks/github You do the same for Transifex, in your project settings page, and point it to the service hook endpoint: /hooks/transifex
Currently there are 4 use cases that are supported:
-
When a resource (configured in this service) in Transifex reaches 100% translated, the Txgh service will pull the translations and commit them to the target repository.
-
When a source file (configured in this service) is pushed to a specific Github branch (also configured in this service), the Txgh service will update the source resource (configured in this service) with the new file.
-
When a source file (configured in this service) is pushed to a specific Github tag (also configured in this service), the Txgh service will update the source resource (configured in this service) with the new file.
-
EXPERIMENTAL - When a source file (configured in this service) is pushed to a specific Github tag called 'L10N', Txgh will create a new branch called 'L10N' and new resources where the slug is prefixed with 'L10N'.
In order to run the server, you need to have Ruby 2.1.5 and bundler installed.
There are 2 important configuration files.
txgh.yml - This is the base configuration for the service. For 12 factor app support, this file should pull it's settings from the Ruby ENV. Additionally, this file can be located in the users $HOME directory to support running the server with hard coded values.
tx.config - This is a configuration which maps the source file, languages, and target translation files. It is based on this specification: http://docs.transifex.com/client/config/#txconfig
https://www.transifex.com/blog/2015/bridging-github-and-transifex-with-txgh/