friendly-traceback / friendly

Friendly-traceback's version used in most situations
https://friendly-traceback.github.io/docs/index.html
MIT License
40 stars 5 forks source link

Default language for friendly #40

Closed aroberge closed 1 year ago

aroberge commented 1 year ago

The following issue was entered by https://github.com/TamilNeram in https://github.com/friendly-traceback/friendly-traceback/issues/159

  1. Need to have a automated way of picking up OS language settings during import of friendly module.
  2. Use that OS language as default if the optional argument is not supplied. i.e. --lang option.
aroberge commented 1 year ago

This is an interesting suggestion. It would likely be easy to implement. Currently, whenever a user changes the language used by friendly, the choice is saved and used as the default language the next time friendly is imported or started on a command line.

To change this, one would need to replace https://github.com/friendly-traceback/friendly/blob/f93b09e6d5aafa16c637dcb05ce3da20c67573ca/friendly/my_gettext.py#L39 by something like

import locale
lang = locale.getdefaultlocale()[0]