Sha256: e043fc8f502bf49887f652806d0d9857e40bcc058d6c6c278e75eeb68bed315a
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
# encoding: UTF-8 module Rosette module Core # Represents a translation. Translations always have an associated phrase, # a locale, and some translated text. # # @!attribute [r] phrase # @return [Phrase] the associated phrase object. # @!attribute [r] locale # @return [String] the locale code. # @!attribute [r] translation # @return [String] the translation text. class Translation include TranslationToHash attr_reader :phrase, :locale, :translation # Creates a new translation object. # # @param [Phrase] phrase The associated phrase object. # @param [String] locale The locale code. # @param [String] translation The translated text. def initialize(phrase, locale, translation) @phrase = phrase @locale = locale @translation = translation end # Turns this translation object into a hash. # # @return [Hash] a hash with +phrase+ as a hash, +locale+, and # +translation+. def self.from_h(hash) new( Phrase.from_h(hash[:phrase]), hash[:locale], hash[:translation] ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rosette-core-1.0.1 | lib/rosette/core/extractor/translation.rb |