Skip to content

Commit

Permalink
Fix Localization
Browse files Browse the repository at this point in the history
  • Loading branch information
queenkjuul committed Nov 22, 2024
1 parent 6bbaaf5 commit 1606304
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion cinnamon-screensaver.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-21 10:28-0600\n"
"POT-Creation-Date: 2024-11-22 04:11-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -104,6 +104,10 @@ msgstr ""
msgid "You have the Caps Lock key on."
msgstr ""

#: src/weather.py:102
msgid "in"
msgstr ""

#. This is the first line of text for the backup-locker, explaining how to switch to tty
#. and run 'cinnamon-unlock-desktop' command. This appears if the screensaver crashes.
#: backup-locker/cs-backup-locker.c:306
Expand Down
7 changes: 6 additions & 1 deletion src/util/openweathermap.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ def __init__(self):

def GetWeather(self, loc: LocationData):
lang = self.locale_to_owm_lang(Pango.language_get_default().to_string())
pref = Pango.language_get_preferred()
pref = list(
map(
lambda p: self.locale_to_owm_lang(p.to_string()),
Pango.language_get_preferred(),
)
)
if lang not in OWM_SUPPORTED_LANGS:
for locale in pref:
if self.locale_to_owm_lang(locale) in OWM_SUPPORTED_LANGS:
Expand Down
6 changes: 5 additions & 1 deletion src/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,18 @@ def update_weather(self):

weather_data = self.weather_provider.GetWeather(self.location)

in_str = " " + _("in") + " "

temp = (
weather_data.temp_f()
if settings.get_weather_units() == "imperial"
else weather_data.temp_c()
)
temp_string = str(round(temp))
default_message = (
weather_data.condition.main + " in " + weather_data.location.city
weather_data.condition.description.title()
+ in_str
+ weather_data.location.city.capitalize()
)

markup = '<b><span font_desc="%s" foreground="#CCCCCC">%s</span></b>\n ' % (
Expand Down

0 comments on commit 1606304

Please sign in to comment.