Skip to content

Commit

Permalink
[bugfix] Add hy to special languages in TimeStripper
Browse files Browse the repository at this point in the history
Also hy needs to check both upper and lower case for months.

Bug: T356175
Change-Id: Ibc7982084102735ffa87fd8d97f6a2813c7176ca
  • Loading branch information
Mpaa committed Jan 30, 2024
1 parent 9b54b3d commit f972c4e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pywikibot/textlib.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Functions for manipulating wiki-text."""
#
# (C) Pywikibot team, 2008-2023
# (C) Pywikibot team, 2008-2024
#
# Distributed under the terms of the MIT license.
#
Expand Down Expand Up @@ -1985,10 +1985,13 @@ def __init__(self, site=None) -> None:
self.site = pywikibot.Site() if site is None else site

self.origNames2monthNum = {}
# use first_lower/first_upper for 'vi' language because monthsnames
# were changed: T324310
functions = [first_upper,
first_lower] if self.site.lang == 'vi' else [str]
# use first_lower/first_upper for those language where month names
# were changed: T324310, T356175
if self.site.lang in ('hy', 'vi'):
functions = [first_upper, first_lower]
else:
functions = [str]

for n, (long, short) in enumerate(self.site.months_names, start=1):
for func in functions:
self.origNames2monthNum[func(long)] = n
Expand Down

0 comments on commit f972c4e

Please sign in to comment.