Coverage for src/backend/InvenTree/InvenTree/setting/locales.py: 100%

2 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 17:47 +0000

1"""Support translation locales for InvenTree. 

2 

3If a new language translation is supported, it must be added here 

4After adding a new language, run the following command: 

5 

6python manage.py makemessages -l <language_code> -e html,js,py --no-wrap 

7 - where <language_code> is the code for the new language 

8 

9Additionally, update the following files with the new locale code: 

10 

11- /src/frontend/.linguirc file 

12- /src/frontend/src/contexts/LanguageContext.tsx 

13 

14(and then run "invoke int.frontend-trans") 

15""" 

16 

17from django.utils.translation import gettext_lazy as _ 

18 

19LOCALES = [ 

20 ('ar', _('Arabic')), 

21 ('bg', _('Bulgarian')), 

22 ('cs', _('Czech')), 

23 ('da', _('Danish')), 

24 ('de', _('German')), 

25 ('el', _('Greek')), 

26 ('en', _('English')), 

27 ('es', _('Spanish')), 

28 ('es-mx', _('Spanish (Mexican)')), 

29 ('et', _('Estonian')), 

30 ('fa', _('Farsi / Persian')), 

31 ('fi', _('Finnish')), 

32 ('fr', _('French')), 

33 ('he', _('Hebrew')), 

34 ('hi', _('Hindi')), 

35 ('hu', _('Hungarian')), 

36 ('it', _('Italian')), 

37 ('ja', _('Japanese')), 

38 ('ko', _('Korean')), 

39 ('lt', _('Lithuanian')), 

40 ('lv', _('Latvian')), 

41 ('nl', _('Dutch')), 

42 ('no', _('Norwegian')), 

43 ('pl', _('Polish')), 

44 ('pt', _('Portuguese')), 

45 ('pt-br', _('Portuguese (Brazilian)')), 

46 ('ro', _('Romanian')), 

47 ('ru', _('Russian')), 

48 ('sk', _('Slovak')), 

49 ('sl', _('Slovenian')), 

50 ('sr', _('Serbian')), 

51 ('sv', _('Swedish')), 

52 ('th', _('Thai')), 

53 ('tr', _('Turkish')), 

54 ('uk', _('Ukrainian')), 

55 ('vi', _('Vietnamese')), 

56 ('zh-hans', _('Chinese (Simplified)')), 

57 ('zh-hant', _('Chinese (Traditional)')), 

58]