Skip to content

Commit

Permalink
feat(i18n): add en-US locale
Browse files Browse the repository at this point in the history
  • Loading branch information
malokhvii-eduard committed Nov 29, 2021
1 parent e91f2e4 commit 61f5e9d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/airly/Config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef AIRLY_INCLUDE_AIRLY_CONFIG_H_
#define AIRLY_INCLUDE_AIRLY_CONFIG_H_

#if !defined(THING_MODEL_B) && !defined(THING_MODEL_M)
#error \
"Undefined thing model! Please define thing model via macro THING_#####_# \
(Example: THING_MODEL_B). Supported thing models: Model B, Model M."
#define THING_UNDEFINED
#endif

#endif // AIRLY_INCLUDE_AIRLY_CONFIG_H_
22 changes: 22 additions & 0 deletions include/airly/I18n.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef AIRLY_INCLUDE_AIRLY_I18N_H_
#define AIRLY_INCLUDE_AIRLY_I18N_H_

/* Compilation-time config */
#include <airly/Config.h>

#if !defined(LANG_EN_US)
#define LANG_UNDEFINED
#error \
"Undefined language! Please define language via macro LANG_##_## \
(Example: LANG_EN_US). Available languages: en-US."
#else
#define LANG_DEFINED
#endif

namespace i18n {

extern const char* DeviceTitle;

} // namespace i18n

#endif // AIRLY_INCLUDE_AIRLY_I18N_H_
15 changes: 15 additions & 0 deletions src/airly/I18n.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <airly/i18n.h>

// -------------------------------------------------------------------------- //
// Translations: stub
// -------------------------------------------------------------------------- //
#if defined(LANG_UNDEFINED)

namespace i18n {

const char* DeviceTitle = "";

} // namespace i18n

#endif
// -------------------------------------------------------------------------- //
18 changes: 18 additions & 0 deletions src/airly/locales/en-US.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <airly/I18n.h>

/* AVR low-level */
#include <avr/pgmspace.h>

// -------------------------------------------------------------------------- //
// Translations: common
// -------------------------------------------------------------------------- //
#if defined(LANG_DEFINED) && defined(THING_MODEL_B)

namespace i18n {

const char* DeviceTitle PROGMEM = "Airly Model B";

} // namespace i18n

#endif
// -------------------------------------------------------------------------- //

0 comments on commit 61f5e9d

Please sign in to comment.