Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

localization.py 753 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  1. import sys
  2. import locale
  3. system_locale = locale.getdefaultlocale()[0]
  4. # system_locale may be nil
  5. system_language = system_locale[0:2] if system_locale is not None else "en"
  6. windows_font_name_map = {
  7. 'en' : 'cour',
  8. 'ru' : 'cour',
  9. 'zn' : 'simsun_01'
  10. }
  11. darwin_font_name_map = {
  12. 'en' : 'cour',
  13. 'ru' : 'cour',
  14. 'zn' : 'Apple LiSung Light'
  15. }
  16. linux_font_name_map = {
  17. 'en' : 'cour',
  18. 'ru' : 'cour',
  19. 'zn' : 'cour'
  20. }
  21. def get_default_ttf_font_name():
  22. platform = sys.platform
  23. if platform[0:3] == 'win': return windows_font_name_map.get(system_language, 'cour')
  24. elif platform == 'darwin': return darwin_font_name_map.get(system_language, 'cour')
  25. else: return linux_font_name_map.get(system_language, 'cour')
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...