Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

separated language option for stencil and display #233

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions wordclock_config/wordclock_config.reference.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,40 @@ developer_mode = False

[wordclock_display]
# set language option
# set stencil language option
# Possible values are:
#
# german
# german2
# english
# spanish
# french
# italian
# turkish
# dutch
# dutch109
# swiss_german
# swiss_german2
language = german

# set language option.
# In german there are more than one possibillity.
# Possible values are:
#
# bavarian
# dutch_10-9
# dutch
# english
# french
# german
# german2
# italian
# swabian
# swabian2
# swiss_german
# swiss_german2
dialect = german

# Choose wiring layout here. Options are: bernds_wiring, christians_wiring, ... (possibly you need your own wiring layout)
wiring_layout = bernds_wiring

Expand Down
37 changes: 21 additions & 16 deletions wordclock_tools/wordclock_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,36 +113,41 @@ def __init__(self, config, wci):
self.default_bg_color = wcc.BLACK

# For backward compatibility
language = ''.join(config.get('wordclock_display', 'language'))
logging.info('Setting language to ' + language + '.')
if language == 'bavarian':
try:
dialect = ''.join(config.get('wordclock_display', 'dialect'))
except:
# For backward compatibility
dialect = ''.join(config.get('wordclock_display', 'language'))
logging.info('Setting dialect to ' + dialect + '.')

if dialect == 'bavarian':
self.taw = time_bavarian.time_bavarian()
elif language == 'dutch':
elif dialect == 'dutch':
self.taw = time_dutch.time_dutch()
elif language == 'english':
elif dialect == 'english':
self.taw = time_english.time_english()
elif language == 'french':
elif dialect == 'french':
self.taw = time_french.time_french()
elif language == 'german':
elif dialect == 'german':
self.taw = time_german.time_german()
elif language == 'german2':
elif dialect == 'german2':
self.taw = time_german2.time_german2()
elif language == 'italian':
elif dialect == 'italian':
self.taw = time_italian.time_italian()
elif language == 'romanian':
elif dialect == 'romanian':
self.taw = time_romanian.time_romanian()
elif language == 'swabian':
elif dialect == 'swabian':
self.taw = time_swabian.time_swabian()
elif language == 'swabian2':
elif dialect == 'swabian2':
self.taw = time_swabian2.time_swabian2()
elif language == 'swedish':
elif dialect == 'swedish':
self.taw = time_swedish.time_swedish()
elif language == 'swiss_german':
elif dialect == 'swiss_german':
self.taw = time_swiss_german.time_swiss_german()
elif language == 'swiss_german2':
elif dialect == 'swiss_german2':
self.taw = time_swiss_german2.time_swiss_german2()
else:
logging.error('Could not detect language: ' + language + '.')
logging.error('Could not detect dialect: ' + dialect + '.')
logging.info('Choosing default: german')
self.taw = time_german.time_german()

Expand Down