[apps/i18n] Derive preferences from country

Each country comes with an set of preferences, built at compile time by
apps/i18n.py, used to define :
  - the exam mode
  - the method for computing quartiles
  - the unit system in which to output the results with units
Functions to access those preferences are available in
via sharedGlobalPreferences.

Change-Id: I220ebaa9b9e8954dfe33cd51936f47505b98978d
This commit is contained in:
Gabriel Ozouf
2020-07-08 16:30:29 +02:00
committed by Émilie Feral
parent e2a6edd78f
commit 2b59509fdd
6 changed files with 45 additions and 15 deletions

View File

@@ -16,6 +16,9 @@ public:
void setLanguage(I18n::Language language) { m_language = language; }
I18n::Country country() const { return m_country; }
void setCountry(I18n::Country country) { m_country = country; }
I18n::AvailableExamModes availableExamModes() const { return I18n::CountryPreferencesArray[static_cast<uint8_t>(m_country)].availableExamModes; }
I18n::MethodForQuartiles methodForQuartiles() const { return I18n::CountryPreferencesArray[static_cast<uint8_t>(m_country)].methodForQuartiles; }
Poincare::Preferences::UnitFormat unitFormat() const { return I18n::CountryPreferencesArray[static_cast<uint8_t>(m_country)].unitFormat; }
bool isInExamMode() const { return (int8_t)examMode() > 0; }
ExamMode examMode() const;
void setExamMode(ExamMode examMode);