mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
Multi-language/I18n support #22
This commit is contained in:
@@ -21,13 +21,10 @@
|
||||
|
||||
#include "telegram.h" // for EMS_VALUE_* settings
|
||||
|
||||
#define FJSON(x) x
|
||||
// #define FJSON(x) F(x)
|
||||
#include "common.h"
|
||||
|
||||
namespace emsesp {
|
||||
|
||||
using flash_string_vector = std::vector<const __FlashStringHelper *>;
|
||||
|
||||
class Helpers {
|
||||
public:
|
||||
static char * render_value(char * result, const float value, const int8_t format); // format is the precision
|
||||
@@ -52,7 +49,9 @@ class Helpers {
|
||||
static int atoint(const char * value);
|
||||
static bool check_abs(const int32_t i);
|
||||
static uint32_t abs(const int32_t i);
|
||||
static float round2(float value, const int8_t divider, const uint8_t fahrenheit = 0);
|
||||
|
||||
static float transformNumFloat(float value, const int8_t numeric_operator, const uint8_t fahrenheit = 0);
|
||||
|
||||
static std::string toLower(std::string const & s);
|
||||
static std::string toUpper(std::string const & s);
|
||||
static void replace_char(char * str, char find, char replace);
|
||||
@@ -68,10 +67,17 @@ class Helpers {
|
||||
static bool value2float(const char * value, float & value_f);
|
||||
static bool value2bool(const char * value, bool & value_b);
|
||||
static bool value2string(const char * value, std::string & value_s);
|
||||
static bool value2enum(const char * value, uint8_t & value_ui, const __FlashStringHelper * const ** strs);
|
||||
static bool value2enum(const char * value, uint8_t & value_ui, const __FlashStringHelper * const * strs);
|
||||
static bool value2temperature(const char * value, float & value_f, bool relative = false);
|
||||
static bool value2temperature(const char * value, int & value_i, const bool relative = false, const int min = -2147483648, const int max = 2147483647);
|
||||
|
||||
static uint8_t count_items(const __FlashStringHelper * const ** list);
|
||||
static uint8_t count_items(const __FlashStringHelper * const * list);
|
||||
|
||||
static std::string translated_word(const __FlashStringHelper * const * strings, bool to_lower = false);
|
||||
static const __FlashStringHelper * translated_fword(const __FlashStringHelper * const * strings);
|
||||
|
||||
#ifdef EMSESP_STANDALONE
|
||||
static char * ultostr(char * ptr, uint32_t value, const uint8_t base);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user