Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit16c6796

Browse files
committed
fix(clock): improve locale handling for time and character encoding
1 parentcd6a8b1 commit16c6796

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/core/widgets/yasb/clock.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def _update_label(self):
153153
label_parts= [partforpartinlabel_partsifpart]
154154
widget_index=0
155155
ifself._locale:
156-
org_locale=locale.getlocale(locale.LC_TIME)
156+
org_locale_time=locale.getlocale(locale.LC_TIME)
157+
org_locale_ctype=locale.getlocale(locale.LC_CTYPE)
157158

158159
forpartinlabel_parts:
159160
part=part.strip()
@@ -165,6 +166,7 @@ def _update_label(self):
165166
try:
166167
ifself._locale:
167168
locale.setlocale(locale.LC_TIME,self._locale)
169+
locale.setlocale(locale.LC_CTYPE,self._locale)
168170
datetime_format_search=re.search('\\{(.*)}',part)
169171
datetime_format_str=datetime_format_search.group()
170172
datetime_format=datetime_format_search.group(1)
@@ -175,7 +177,8 @@ def _update_label(self):
175177
active_widgets[widget_index].setText(format_label_content)
176178
widget_index+=1
177179
ifself._locale:
178-
locale.setlocale(locale.LC_TIME,org_locale)
180+
locale.setlocale(locale.LC_TIME,org_locale_time)
181+
locale.setlocale(locale.LC_CTYPE,org_locale_ctype)
179182

180183
def_next_timezone(self):
181184
self._active_tz=next(self._timezones)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp