12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/sgtn-client/loader/source_comparer.rb', line 12
def load_bundle(component, locale)
SgtnClient.logger.debug "[#{__FILE__}][#{__callee__}] component=#{component}, locale=#{locale}"
real_locale = cache_to_real_map[locale]
return super(component, real_locale) if real_locale
old_source_bundle_thread = Thread.new { load_bundle(component, CONSTS::OLD_SOURCE_LOCALE) }
source_bundle_thread = Thread.new { load_bundle(component, LocaleUtil.get_source_locale) }
translation_bundle = super(component, locale)
begin
old_source_bundle = old_source_bundle_thread.value
source_bundle = source_bundle_thread.value
rescue StandardError => e
SgtnClient.logger.error "[#{__FILE__}][#{__callee__}] failed to load soruce(or old source) bundle. component:#{component}. error: #{e}"
return translation_bundle
end
compare_source(translation_bundle, old_source_bundle, source_bundle)
end
|