add cenhomes addons
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import calendar
|
||||
import json
|
||||
import os
|
||||
|
||||
path_file = os.path.dirname(__file__)
|
||||
|
||||
dict_languages = {
|
||||
'de': json.load(open(f'{path_file}/../static/lang/de.json'))
|
||||
}
|
||||
|
||||
|
||||
def convert_month(month: int):
|
||||
if month < 1 or month > 12:
|
||||
return None
|
||||
return calendar.month_name[month]
|
||||
|
||||
|
||||
def convert_common(text: str, lang: str = 'de'):
|
||||
if lang not in dict_languages or text is None or text == False:
|
||||
return None
|
||||
return dict_languages.get(lang).get(text.lower())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(convert_month(0))
|
||||
print(convert_month(3))
|
||||
print(convert_common('english'))
|
||||
Reference in New Issue
Block a user