7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/sgtn-client/loader/source_comparer.rb', line 7
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
source_bundle_thread = Thread.new { load_bundle(component, LocaleUtil.get_source_locale) }
translation_bundle = super
begin
old_source_bundle = translation_bundle.origin.load_bundle(component, old_source_locale(locale))
rescue StandardError => e
SgtnClient.logger.error "[#{__FILE__}][#{__callee__}] failed to load old source bundle. component:#{component}. error: #{e}"
end
begin
source_bundle = source_bundle_thread.value
rescue StandardError => e
SgtnClient.logger.error "[#{__FILE__}][#{__callee__}] failed to load source bundle. component:#{component}. error: #{e}"
return translation_bundle
end
compare_source(translation_bundle, old_source_bundle, source_bundle)
end
|