Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1#!/usr/bin/env python 

2 

3""" 

4camcops_server/cc_modules/cc_language.py 

5 

6=============================================================================== 

7 

8 Copyright (C) 2012-2020 Rudolf Cardinal (rudolf@pobox.com). 

9 

10 This file is part of CamCOPS. 

11 

12 CamCOPS is free software: you can redistribute it and/or modify 

13 it under the terms of the GNU General Public License as published by 

14 the Free Software Foundation, either version 3 of the License, or 

15 (at your option) any later version. 

16 

17 CamCOPS is distributed in the hope that it will be useful, 

18 but WITHOUT ANY WARRANTY; without even the implied warranty of 

19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

20 GNU General Public License for more details. 

21 

22 You should have received a copy of the GNU General Public License 

23 along with CamCOPS. If not, see <https://www.gnu.org/licenses/>. 

24 

25=============================================================================== 

26 

27**Constants for languages/internationalization.** 

28 

29This represents known languages (or, strictly, locales). Compare 

30``language.cpp`` on the client. 

31 

32At present we don't make this user-configurable and arbitrary (e.g. via an XML 

33file to define languages), largely because it would a little complexity for the 

34user, and because there's not much point in adding a language to the server 

35without adding it for the client, too -- and the client needs recompiling. 

36 

37Note that both Python locales (see e.g. ``locale.getlocale()``) and Qt use 

38underscores -- e.g. ``en_GB`` -- so we will too. 

39 

40""" 

41 

42# ============================================================================= 

43# Languages 

44# ============================================================================= 

45 

46DANISH = "da_DK" 

47ENGLISH_UK = "en_GB" 

48 

49POSSIBLE_LOCALES_WITH_DESCRIPTIONS = ( 

50 # Default locale should be first (for auto-selecting <select> HTML). 

51 (ENGLISH_UK, "English (UK)"), # DEFAULT LOCALE 

52 (DANISH, "Dansk"), 

53) 

54 

55 

56# ============================================================================= 

57# Other constants 

58# ============================================================================= 

59 

60DEFAULT_LOCALE = ENGLISH_UK 

61GETTEXT_DOMAIN = "camcops" # don't alter this 

62POSSIBLE_LOCALES = [_[0] for _ in POSSIBLE_LOCALES_WITH_DESCRIPTIONS]