diff options
author | Milo Casagrande <milo.casagrande@linaro.org> | 2015-02-09 17:42:03 +0800 |
---|---|---|
committer | Milo Casagrande <milo.casagrande@linaro.org> | 2015-02-09 17:42:03 +0800 |
commit | bc2489e968ac8acc4ff994e312b1df96e4acb302 (patch) | |
tree | b2e08e957c7686a8b5ae1c0d6558aeb45d56b657 /app/utils/report/boot.py | |
parent | f4935ce2c2b39171f3013a411b554935debbc09e (diff) |
Re-rename i18n functions.
Change-Id: Ifdbb10b345faa521d2fa8d2068ae11c23f7652ac
Diffstat (limited to 'app/utils/report/boot.py')
-rw-r--r-- | app/utils/report/boot.py | 98 |
1 files changed, 48 insertions, 50 deletions
diff --git a/app/utils/report/boot.py b/app/utils/report/boot.py index 727fa32..746ff07 100644 --- a/app/utils/report/boot.py +++ b/app/utils/report/boot.py @@ -27,12 +27,10 @@ import utils.report.common as rcommon # plural forms capabilities. We mark the email string as translatable though # so we might give that feature in the future. L10N = gettext.translation(models.I18N_DOMAIN, fallback=True) - -# pylint: disable=invalid-name # Register normal Unicode gettext. -_g = L10N.ugettext +G_ = L10N.ugettext # Register plural forms Unicode gettext. -_p = L10N.ungettext +P_ = L10N.ungettext BOOT_SEARCH_SORT = [ @@ -414,9 +412,9 @@ def _create_boot_email(**kwargs): email_body = u"" subject_str = _get_boot_subject_string(**kwargs) - tested_one = _g(u"Tested: %s\n") - tested_two = _g(u"Tested: %s, %s\n") - tested_three = _g(u"Tested: %s, %s, %s\n") + tested_one = G_(u"Tested: %s\n") + tested_two = G_(u"Tested: %s, %s\n") + tested_three = G_(u"Tested: %s, %s, %s\n") tested_string = None if total_unique_data: @@ -431,17 +429,17 @@ def _create_boot_email(**kwargs): kwargs["unique_socs"] = unique_socs kwargs["unique_builds"] = unique_builds - boards_str = _p( + boards_str = P_( u"%(unique_boards)d unique board", u"%(unique_boards)d unique boards", unique_boards ) - soc_str = _p( + soc_str = P_( u"%(unique_socs)d SoC family", u"%(unique_socs)d SoC families", unique_socs ) - builds_str = _p( + builds_str = P_( u"%(unique_builds)s build out of %(total_builds)s", u"%(unique_builds)s builds out of %(total_builds)s", unique_builds @@ -468,20 +466,20 @@ def _create_boot_email(**kwargs): boot_summary_url = u"%(boot_url)s/%(job)s/kernel/%(kernel)s/" % kwargs build_summary_url = u"%(build_url)s/%(job)s/kernel/%(kernel)s/" % kwargs - tree = _g(u"Tree: %(job)s\n") % kwargs - branch = _g(u"Branch: %(git_branch)s\n") % kwargs - git_describe = _g(u"Git Describe: %(kernel)s\n") % kwargs - git_commit = _g(u"Git Commit: %(git_commit)s\n") % kwargs - git_url = _g(u"Git URL: %(git_url)s\n") % kwargs + tree = G_(u"Tree: %(job)s\n") % kwargs + branch = G_(u"Branch: %(git_branch)s\n") % kwargs + git_describe = G_(u"Git Describe: %(kernel)s\n") % kwargs + git_commit = G_(u"Git Commit: %(git_commit)s\n") % kwargs + git_url = G_(u"Git URL: %(git_url)s\n") % kwargs with io.StringIO() as m_string: m_string.write(subject_str) m_string.write(u"\n") m_string.write(u"\n") m_string.write( - _g(u"Full Boot Summary: %s\n") % boot_summary_url) + G_(u"Full Boot Summary: %s\n") % boot_summary_url) m_string.write( - _g(u"Full Build Summary: %s\n") % build_summary_url) + G_(u"Full Build Summary: %s\n") % build_summary_url) m_string.write(u"\n") m_string.write(tree) m_string.write(branch) @@ -497,7 +495,7 @@ def _create_boot_email(**kwargs): if info_email: m_string.write(u"\n") m_string.write(u"---\n") - m_string.write(_g(u"For more info write to <%s>") % info_email) + m_string.write(G_(u"For more info write to <%s>") % info_email) email_body = m_string.getvalue() @@ -537,19 +535,19 @@ def _get_boot_subject_string(**kwargs): offline_count = k_get("offline_count", 0) subject_str = u"" - base_subject = _g(u"%(job)s boot") - total_boots = _p( + base_subject = G_(u"%(job)s boot") + total_boots = P_( u"%(total_count)d boot", u"%(total_count)d boots", total_count) - passed_boots = _g(u"%(pass_count)d passed") - failed_boots = _g(u"%(fail_count)d failed") - conflict_boots = _p( + passed_boots = G_(u"%(pass_count)d passed") + failed_boots = G_(u"%(fail_count)d failed") + conflict_boots = P_( u"%(conflict_count)d conflict", u"%(conflict_count)d conflicts", conflict_count ) - offline_boots = _g(u"%(offline_count)d offline") - kernel_name = _g(u"(%(kernel)s)") - lab_name_str = _g(u"%(lab_name)s") + offline_boots = G_(u"%(offline_count)d offline") + kernel_name = G_(u"(%(kernel)s)") + lab_name_str = G_(u"%(lab_name)s") subject_substitutions = { "boot_name": base_subject, @@ -562,58 +560,58 @@ def _get_boot_subject_string(**kwargs): "lab_description": lab_name_str } - subject_all_pass = _g( + subject_all_pass = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s %(kernel_name)s") - subject_all_pass_with_lab = _g( + subject_all_pass_with_lab = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s %(kernel_name)s " "- %(lab_description)s") - subject_pass_with_offline = _g( + subject_pass_with_offline = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, " "%(offline_boots)s %(kernel_name)s") - subject_pass_with_offline_with_lab = _g( + subject_pass_with_offline_with_lab = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, " "%(offline_boots)s %(kernel_name)s - %(lab_description)s") - subject_pass_with_conflict = _g( + subject_pass_with_conflict = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, " "%(conflict_boots)s %(kernel_name)s") - subject_pass_with_conflict_with_lab = _g( + subject_pass_with_conflict_with_lab = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, " "%(conflict_boots)s %(kernel_name)s - %(lab_description)s") - subject_only_fail = _g( + subject_only_fail = G_( u"%(boot_name)s: %(total_boots)s: %(failed_boots)s %(kernel_name)s") - subject_only_fail_with_lab = _g( + subject_only_fail_with_lab = G_( u"%(boot_name)s: %(total_boots)s: %(failed_boots)s %(kernel_name)s " "- %(lab_description)s") - subject_with_fail = _g( + subject_with_fail = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, " "%(failed_boots)s %(kernel_name)s") - subject_with_fail_with_lab = _g( + subject_with_fail_with_lab = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, " "%(failed_boots)s %(kernel_name)s - %(lab_description)s") - subject_with_fail_and_conflict = _g( + subject_with_fail_and_conflict = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, %(failed_boots)s " "with %(conflict_boots)s %(kernel_name)s") - subject_with_fail_and_conflict_with_lab = _g( + subject_with_fail_and_conflict_with_lab = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, %(failed_boots)s " "with %(conflict_boots)s %(kernel_name)s - %(lab_description)s") - subject_with_fail_and_offline = _g( + subject_with_fail_and_offline = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, %(failed_boots)s " "with %(offline_boots)s %(kernel_name)s") - subject_with_fail_and_offline_with_lab = _g( + subject_with_fail_and_offline_with_lab = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, %(failed_boots)s " "with %(offline_boots)s %(kernel_name)s - %(lab_description)s") - all_subject = _g( + all_subject = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, " "%(failed_boots)s with %(conflict_boots)s, %(offline_boots)s " "%(kernel_name)s") - all_subject_with_lab = _g( + all_subject_with_lab = G_( u"%(boot_name)s: %(total_boots)s: %(passed_boots)s, " "%(failed_boots)s with %(conflict_boots)s, %(offline_boots)s " "%(kernel_name)s - %(lab_description)s") @@ -718,29 +716,29 @@ def _parse_and_write_results(m_string, **kwargs): for arch in data.viewkeys(): m_string.write(u"\n") m_string.write( - _g(u"%s:\n") % arch + G_(u"%s:\n") % arch ) for defconfig in d_get(arch).viewkeys(): m_string.write(u"\n") m_string.write( - _g(u" %s:\n") % defconfig + G_(u" %s:\n") % defconfig ) def_get = d_get(arch)[defconfig].get for board in d_get(arch)[defconfig].viewkeys(): m_string.write( - _g(u" %s:\n") % board + G_(u" %s:\n") % board ) for lab in def_get(board).viewkeys(): m_string.write( - _g(u" %s: %s\n") % + G_(u" %s: %s\n") % (lab, def_get(board)[lab]) ) if offline_data: - m_string.write(_g(u"\nOffline Platforms:\n")) + m_string.write(G_(u"\nOffline Platforms:\n")) _traverse_data_struct(offline_data, m_string) if failed_data: @@ -748,7 +746,7 @@ def _parse_and_write_results(m_string, **kwargs): m_string.write(u"\n") m_string.write( - _p( + P_( u"Boot Failure Detected: %(boot_failure_url)s\n", u"Boot Failures Detected: %(boot_failure_url)s\n", fail_count @@ -758,12 +756,12 @@ def _parse_and_write_results(m_string, **kwargs): _traverse_data_struct(failed_data, m_string) if conflict_data: - conflict_comment = _g( + conflict_comment = G_( u"(These likely are not failures as other labs are reporting " "PASS. Please review.)") m_string.write(u"\n") m_string.write( - _p( + P_( u"Conflicting Boot Failure Detected: %(conflict_comment)s\n", u"Conflicting Boot Failures Detected: %(conflict_comment)s\n", conflict_count |