class PackerFiles::Core::Locale
Define the Locale
class that can handle locales specified in a Packerfile. Just the barebones attributes that are required for this class are specified here. The conversion of these attributes into a OS build specific file is done by derived classes in the OS specific directories.
Attributes
country[RW]
default[RW]
Specify attributes
language[RW]
supported[RW]
Public Class Methods
doc_file()
click to toggle source
Documentation for this class
# File lib/PackerFiles/Core/Locale.rb, line 21 def self.doc_file PackerFiles.DirPath('Core/example/Locale.txt').first end
new() { |self| ... }
click to toggle source
Constructor to just specify accessor varibales
# File lib/PackerFiles/Core/Locale.rb, line 26 def initialize @supported = [] yield self if block_given? end
Public Instance Methods
normalize(utf = true, str='.UTF-8')
click to toggle source
Normalize the various values into something useful. Usually this means adding UTF-8 into the default string. if desired
# File lib/PackerFiles/Core/Locale.rb, line 33 def normalize(utf = true, str='.UTF-8') # Concatenate language and country if the detailed notation # instead of the simpler one is preferred. if (!@language.nil? && !@country.nil?) @default = @language + '_' + @country end # If you need to add UTF prefixes, then add them to the # default locale. if (utf && !@default.end_with?(str)) @default = @default + str end # If you need to add UTF prefixes for all the supported # locales, do the same. @supported.map! {|x| if (utf && !x.end_with?(str)) x + str else x end } end