show_utf8_only.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. --- a/usr/lib/linuxmint/mintlocale/mintlocale.py
  2. +++ b/usr/lib/linuxmint/mintlocale/mintlocale.py
  3. @@ -279,7 +279,7 @@
  4. vbox = Gtk.VBox()
  5. vbox.pack_start(image, False, False, 2)
  6. label = Gtk.Label()
  7. - label.set_markup(title)
  8. + label.set_text(title)
  9. vbox.pack_start(label, False, False, 2)
  10. menuitem.add(vbox)
  11. else:
  12. @@ -720,7 +720,10 @@
  13. vars[var_name] = value
  14. if "LANG" in vars:
  15. locale = vars['LANG'].replace('"', '').replace("'", "")
  16. - locale = locale.split(".")[0].strip()
  17. + locale = locale.replace("utf8", "UTF-8")
  18. + locale = locale.replace("UTF-8", "")
  19. + locale = locale.replace(".", "")
  20. + locale = locale.strip()
  21. if "_" in locale:
  22. split = locale.split("_")
  23. if len(split) == 2:
  24. @@ -745,7 +748,10 @@
  25. if "LC_NUMERIC" in vars:
  26. locale = vars['LC_NUMERIC'].replace('"', '').replace("'", "")
  27. - locale = locale.split(".")[0].strip()
  28. + locale = locale.replace("utf8", "UTF-8")
  29. + locale = locale.replace("UTF-8", "")
  30. + locale = locale.replace(".", "")
  31. + locale = locale.strip()
  32. if "_" in locale:
  33. split = locale.split("_")
  34. if len(split) == 2:
  35. @@ -773,7 +779,7 @@
  36. self.system_label.set_markup("<b>%s</b>\n<small>%s <i>%s</i>\n%s <i>%s</i></small>" % (_("System locale"), language_prefix, language_str, region_prefix, region_str))
  37. def set_num_installed(self):
  38. - num_installed = int(subprocess.check_output("localedef --list-archive | wc -l", shell=True))
  39. + num_installed = int(subprocess.check_output("localedef --list-archive | grep utf8 | wc -l", shell=True))
  40. self.install_label.set_markup("<b>%s</b>\n<small>%s</small>" % (_("Language support"), gettext.ngettext("%d language installed", "%d languages installed", num_installed) % num_installed))
  41. def accountservice_ready(self, user, param):
  42. @@ -827,11 +833,12 @@
  43. built_locales = {}
  44. for line in locales.rstrip().split("\n"):
  45. line = line.replace("utf8", "UTF-8")
  46. - cur_index += 1
  47. - locale_code = line.split(".")[0].strip()
  48. - charmap = None
  49. - if len(line.split(".")) > 1:
  50. - charmap = line.split(".")[1].strip()
  51. + if "UTF-8" not in line:
  52. + continue
  53. + cur_index += 1
  54. + locale_code = line.replace("UTF-8", "")
  55. + locale_code = locale_code.replace(".", "")
  56. + locale_code = locale_code.strip()
  57. if "_" in locale_code:
  58. split = locale_code.split("_")
  59. @@ -843,16 +850,13 @@
  60. else:
  61. language = language_code
  62. - country_code = split[1].lower().split('@')[0].strip()
  63. + country_code = split[1].lower()
  64. if country_code in self.countries:
  65. country = self.countries[country_code]
  66. else:
  67. country = country_code
  68. - if '@' in split[1]:
  69. - language_label = u"%s (@%s), %s" % (language, split[1].split('@')[1].strip(), country)
  70. - else:
  71. - language_label = u"%s, %s" % (language, country)
  72. + language_label = u"%s, %s" % (language, country)
  73. flag_path = FLAG_PATH % country_code
  74. else:
  75. @@ -864,9 +868,6 @@
  76. flag_path = self.set_minority_language_flag_path(locale_code, flag_path)
  77. - if charmap is not None and not all_locales_are_utf8:
  78. - language_label = u"%s <small><span foreground='#3c3c3c'>%s</span></small>" % (language_label, charmap)
  79. -
  80. if os.path.exists(flag_path):
  81. flag = flag_path
  82. else:
  83. @@ -892,7 +893,7 @@
  84. def set_user_locale(self, path, locale):
  85. self.locale_button.set_button_label(locale.name)
  86. - print(u"Setting language to %s" % locale.id)
  87. + print(u"Setting language to '%s' '%s'" % (locale.name, locale.id))
  88. # Set it in Accounts Service
  89. try:
  90. self.accountService.set_language(locale.id)
  91. @@ -916,7 +917,7 @@
  92. def set_user_region(self, path, locale):
  93. self.region_button.set_button_label(locale.name)
  94. - print("Setting region to %s" % locale.id)
  95. + print("Setting region to '%s' '%s'" % (locale.name, locale.id))
  96. # We don't call self.accountService.set_formats_locale(locale.id) here...
  97. # First, we don't really use AccountsService, we're only doing this to be nice to LightDM and all..