Module: LocalizationSimplified

Defined in:
lib/extensions/rholang/rholang/lang_cf.rb,
lib/framework/rholang/lang_en.rb,
lib/framework/rholang/lang_es.rb,
lib/extensions/rholang/rholang/lang_ca.rb,
lib/extensions/rholang/rholang/lang_cs.rb,
lib/extensions/rholang/rholang/lang_da.rb,
lib/extensions/rholang/rholang/lang_de.rb,
lib/extensions/rholang/rholang/lang_es.rb,
lib/extensions/rholang/rholang/lang_fi.rb,
lib/extensions/rholang/rholang/lang_fr.rb,
lib/extensions/rholang/rholang/lang_it.rb,
lib/extensions/rholang/rholang/lang_ko.rb,
lib/extensions/rholang/rholang/lang_nl.rb,
lib/extensions/rholang/rholang/lang_no.rb,
lib/extensions/rholang/rholang/lang_pt.rb,
lib/extensions/rholang/rholang/lang_ru.rb,
lib/extensions/rholang/rholang/lang_se.rb,
lib/extensions/rholang/rholang/lang_sr.rb,
lib/extensions/rholang/rholang/lang_chef.rb,
lib/extensions/rholang/rholang/lang_es_ar.rb,
lib/extensions/rholang/rholang/lang_pt_br.rb,
lib/framework/rholang/localization_simplified.rb,
lib/framework/autocomplete/LocalizationSimplified.rb

Overview

It is auto-generated content. Do not do required for this file in your application.

Defined Under Namespace

Classes: ActiveRecord, ArrayHelper, DateHelper, NumberHelper

Constant Summary collapse

About =
{}
@@ignore =

%% == Literal “%” character

"\xFF\xFF\xFF\xFF"
@@cur_locale =

‘en’

nil
@@cur_country =

‘en’

nil

Class Method Summary collapse

Class Method Details

.get_cur_countryObject



26
27
28
# File 'lib/framework/rholang/localization_simplified.rb', line 26

def self.get_cur_country
  @@cur_country  
end

.get_cur_localeObject



22
23
24
# File 'lib/framework/rholang/localization_simplified.rb', line 22

def self.get_cur_locale
  @@cur_locale  
end

.init_current_localeObject



37
38
39
40
41
42
43
44
45
# File 'lib/framework/rholang/localization_simplified.rb', line 37

def self.init_current_locale
    return if @@cur_locale
    
    @@cur_locale = System::get_locale()
    @@cur_locale = @@cur_locale.downcase if @@cur_locale
    @@cur_locale = 'en' unless @@cur_locale
    @@cur_country = System::get_property("country")
    @@cur_country = @@cur_country.downcase if @@cur_country
end

.localize_strftime(date, time) ⇒ Object

substitute all daynames and monthnames with localized names from RUtils plugin



13
14
15
16
17
18
19
20
# File 'lib/framework/rholang/localization_simplified.rb', line 13

def self.localize_strftime(date='%d.%m.%Y', time='')
  #date.gsub!('%%', @@ignore)
  date.gsub!('%a', LocalizationSimplified::DateHelper::AbbrDaynames[time.wday])
  date.gsub!('%A', LocalizationSimplified::DateHelper::Daynames[time.wday])
  date.gsub!('%b', LocalizationSimplified::DateHelper::AbbrMonthnames[time.mon])
  date.gsub!('%B', LocalizationSimplified::DateHelper::Monthnames[time.mon])
  #date.gsub!(@@ignore, '%%')
end

.requre_loc(file, check_exist) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/framework/rholang/localization_simplified.rb', line 47

def self.requre_loc(file,check_exist)
    init_current_locale()

    unless check_exist
if Rho::System.isRhoSimulator
        file = File.join( __rhoGetRhodesDir(), 'lib/framework', file)
else
        file = File.join( __rhoGetRuntimeDir(), 'lib', file)
end            
    end

  puts "Locilized file: #{file}"
  
    if @@cur_country && @@cur_country.length() > 0 && Rho::file_exist?(file + @@cur_locale + '_' + @@cur_country + RHO_RB_EXT) 
        load file + @@cur_locale + '_' + @@cur_country
    elsif Rho::file_exist?(file + @@cur_locale + RHO_RB_EXT)
        load file + @@cur_locale
    else    
        puts 'Could not find resources for locale: ' + @@cur_locale.to_s + ";file: #{file}" if @@cur_locale != 'en'
        if @@cur_locale != 'en' && Rho::file_exist?(file + 'en' + RHO_RB_EXT)
            puts 'Load english resources.'
            load file + 'en'
        end    
    end
end

.set_cur_locale(loc, country) ⇒ Object



30
31
32
33
34
35
# File 'lib/framework/rholang/localization_simplified.rb', line 30

def self.set_cur_locale(loc, country)
  @@cur_locale = loc
  @@cur_country = country  
  
  puts "Current locale: #{@@cur_locale}; Country code: #{@@cur_country}"
end