class Danger::DangerTransifex
Plugin to push Transifex
translations
@example Pushes your source language translations
transifex.push_source(path/to/your.strings)
@see Emil Bogren/danger-transifex @tags translations, transifex
Public Instance Methods
configure(project_name, resource_name)
click to toggle source
Configure the Transifex
client with your project name and resource. The resource is a single source of translations.
# File lib/transifex/plugin.rb, line 15 def configure(project_name, resource_name) require 'transifex' Transifex.configure do |c| c.client_login = ENV['TRANSIFEX_API'] c.client_secret = ENV['TRANSIFEX_API_TOKEN'] end @project = Transifex::Project.new(project_name) @resource = @project.resource(resource_name) end
push_source(type, source)
click to toggle source
Push the source language file to transifex, please note the source is the only allowed resource to use with this method.
# File lib/transifex/plugin.rb, line 28 def push_source(type, source) unless @resource.nil? begin message("Translations changed - pushing changes to Transifex") @resource.content.update({:i18n_type => type, :content => source}) message("Translations updated \u{2705}") rescue warn("Updating translations failed \u{274C}") end end end