Browse Source

Solving locale problems

pull/3/head
Louis 11 years ago
parent
commit
4e1b6d30dd
  1. 6
      songbook.py
  2. 3
      songbook/plastex.py

6
songbook.py

@ -36,7 +36,11 @@ def argument_parser(args):
def main(): def main():
# set script locale to match user's # set script locale to match user's
locale.setlocale(locale.LC_ALL, '') try:
locale.setlocale(locale.LC_ALL, '')
except locale.Error as error:
# Locale is not installed on user's system, or wrongly configured.
sys.stderr.write("Locale error: {}\n".format(error.message))
options = argument_parser(sys.argv[1:]) options = argument_parser(sys.argv[1:])

3
songbook/plastex.py

@ -80,7 +80,8 @@ def parsetex(filename):
doc = SongParser.parse(filename) doc = SongParser.parse(filename)
# /* BEGIN plasTeX patch # /* BEGIN plasTeX patch
locale.setlocale(locale.LC_TIME, "%s.%s" % oldlocale) if oldlocale[0] and oldlocale[1]:
locale.setlocale(locale.LC_TIME, "%s.%s" % oldlocale)
# plasTeX patch END */ # plasTeX patch END */
# Extraction des données # Extraction des données

Loading…
Cancel
Save