Coverage for cc_modules/cc_language.py: 100%
6 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-15 14:23 +0100
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-15 14:23 +0100
1"""
2camcops_server/cc_modules/cc_language.py
4===============================================================================
6 Copyright (C) 2012, University of Cambridge, Department of Psychiatry.
7 Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
9 This file is part of CamCOPS.
11 CamCOPS is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 CamCOPS is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with CamCOPS. If not, see <https://www.gnu.org/licenses/>.
24===============================================================================
26**Constants for languages/internationalization.**
28This represents known languages (or, strictly, locales). Compare
29``language.cpp`` on the client.
31At present we don't make this user-configurable and arbitrary (e.g. via an XML
32file to define languages), largely because it would a little complexity for the
33user, and because there's not much point in adding a language to the server
34without adding it for the client, too -- and the client needs recompiling.
36Note that both Python locales (see e.g. ``locale.getlocale()``) and Qt use
37underscores -- e.g. ``en_GB`` -- so we will too.
39"""
41# =============================================================================
42# Languages
43# =============================================================================
45DANISH = "da_DK"
46ENGLISH_UK = "en_GB"
48POSSIBLE_LOCALES_WITH_DESCRIPTIONS = (
49 # Default locale should be first (for auto-selecting <select> HTML).
50 (ENGLISH_UK, "English (UK)"), # DEFAULT LOCALE
51 (DANISH, "Dansk"),
52)
55# =============================================================================
56# Other constants
57# =============================================================================
59DEFAULT_LOCALE = ENGLISH_UK
60GETTEXT_DOMAIN = "camcops" # don't alter this
61POSSIBLE_LOCALES = [_[0] for _ in POSSIBLE_LOCALES_WITH_DESCRIPTIONS]