class Tml::Decorators::Json
Public Instance Methods
decorate(translated_label, translation_language, target_language, translation_key, options = {})
click to toggle source
# File lib/tml/decorators/json.rb, line 35 def decorate(translated_label, translation_language, target_language, translation_key, options = {}) #Tml.logger.info("Decorating #{translated_label} of #{translation_language.locale} to #{target_language.locale}") data = { original: { label: translation_key.label, locale: translation_key.locale }, translation: { label: translated_label, locale: translation_language.locale, }, options: options, target_locale: target_language.locale } if options[:locked] data[:status] = 'locked' elsif translation_language == translation_key.language if options[:pending] data[:status] = 'pending' else data[:status] = 'not_translated' end elsif translation_language == target_language data[:status] = 'translated' else data[:status] = 'fallback' end data end