Skip to content

Commit

Permalink
Merge pull request #38655 from code-dot-org/i18n-sync-logging
Browse files Browse the repository at this point in the history
Adding lifecycle logging for i18n sync scripts
  • Loading branch information
daynew committed Jan 21, 2021
2 parents d8685f5 + fd9a7ac commit 23cef56
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
4 changes: 3 additions & 1 deletion bin/i18n/sync-all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ def return_to_staging_branch
# so error out.
raise "Tried to return to staging branch from unknown branch #{GitUtils.current_branch.inspect}"
end

`git checkout staging` if should_i "switch to staging branch"
rescue => e
puts "return_to_staging_branch failed from the error: #{e}"
raise e
end
end

Expand Down
8 changes: 5 additions & 3 deletions bin/i18n/sync-down.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def with_elapsed

def sync_down
I18nScriptUtils.with_synchronous_stdout do
puts "Beginning sync down"

puts "Sync down starting"
logger = Logger.new(STDOUT)
logger.level = Logger::INFO

Expand Down Expand Up @@ -53,7 +52,10 @@ def sync_down
puts "Files downloaded in #{elapsed}"
end

puts "Sync down complete"
puts "Sync down completed successfully"
rescue => e
puts "Sync down failed from the error: #{e}"
raise e
end
end

Expand Down
5 changes: 5 additions & 0 deletions bin/i18n/sync-in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
require_relative '../../tools/scripts/ManifestBuilder'

def sync_in
puts "Sync in starting"
HocSyncUtils.sync_in
localize_level_content
localize_project_content
Expand All @@ -27,6 +28,10 @@ def sync_in
redact_level_content
redact_block_content
localize_markdown_content
puts "Sync in completed successfully"
rescue => e
puts "Sync in failed from the error: #{e}"
raise e
end

def get_i18n_strings(level)
Expand Down
5 changes: 5 additions & 0 deletions bin/i18n/sync-out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
require_relative '../../tools/scripts/ManifestBuilder'

def sync_out(upload_manifests=false)
puts "Sync out starting"
rename_from_crowdin_name_to_locale
restore_redacted_files
distribute_translations(upload_manifests)
Expand All @@ -32,6 +33,10 @@ def sync_out(upload_manifests=false)
I18nScriptUtils.with_synchronous_stdout do
I18nScriptUtils.run_standalone_script "dashboard/scripts/update_tts_i18n.rb"
end
puts "Sync out completed successfully"
rescue => e
puts "Sync out failed from the error: #{e}"
raise e
end

# Return true iff the specified file in the specified locale had changes
Expand Down
8 changes: 5 additions & 3 deletions bin/i18n/sync-up.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

def sync_up
I18nScriptUtils.with_synchronous_stdout do
puts "Beginning sync up"

puts "Sync up starting"
CROWDIN_PROJECTS.each do |name, options|
puts "Uploading source strings to #{name} project"
command = "crowdin --config #{options[:config_file]} --identity #{options[:identity_file]} upload sources"
Expand All @@ -27,7 +26,10 @@ def sync_up
end
end

puts "Sync up complete"
puts "Sync up completed successfully"
rescue => e
puts "Sync up failed from the error: #{e}"
raise e
end
end

Expand Down

0 comments on commit 23cef56

Please sign in to comment.