class Translatomatic::Model::Locale
Locale
database record. Used to store translations in the database.
Public Class Methods
from_tag(tag)
click to toggle source
Create a locale record from an I18n::Locale::Tag object or string @return [Translatomatic::Model::Locale] Locale
record
# File lib/translatomatic/model/locale.rb, line 12 def self.from_tag(tag) tag = Translatomatic::Locale.parse(tag) find_or_create_by!( language: tag.language, script: tag.script, region: tag.region ) end
Public Instance Methods
to_s()
click to toggle source
@return [String] Locale
as string
# File lib/translatomatic/model/locale.rb, line 20 def to_s [language, script, region].compact.join('-') end