Skip to content

Commit

Permalink
feat: lv_i18n_phrase_t uses the const type
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor authored Mar 11, 2024
2 parents b509a1d + a908c3f commit 8904107
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/compiler_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static inline uint32_t op_e(uint32_t val) { UNUSED(val); return 0; }
function lang_plural_template(l, form, data) {
const loc = to_c(l);
return `
static lv_i18n_phrase_t ${loc}_plurals_${form}[] = {
static const lv_i18n_phrase_t ${loc}_plurals_${form}[] = {
${Object.entries(data[l].plural[form]).map(([ k, val ]) => ` {"${esc(k)}", "${esc(val)}"},`).join('\n')}
{NULL, NULL} // End mark
};
Expand All @@ -58,7 +58,7 @@ ${Object.entries(data[l].plural[form]).map(([ k, val ]) => ` {"${esc(k)}", "$
function lang_singular_template(l, data) {
const loc = to_c(l);
return `
static lv_i18n_phrase_t ${loc}_singulars[] = {
static const lv_i18n_phrase_t ${loc}_singulars[] = {
${Object.entries(data[l].singular).map(([ k, val ]) => ` {"${esc(k)}", "${esc(val)}"},`).join('\n')}
{NULL, NULL} // End mark
};
Expand Down
4 changes: 2 additions & 2 deletions src/lv_i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ typedef struct {

typedef struct {
const char * locale_name;
lv_i18n_phrase_t * singulars;
lv_i18n_phrase_t * plurals[_LV_I18N_PLURAL_TYPE_NUM];
const lv_i18n_phrase_t * singulars;
const lv_i18n_phrase_t * plurals[_LV_I18N_PLURAL_TYPE_NUM];
uint8_t (*locale_plural_fn)(int32_t num);
} lv_i18n_lang_t;

Expand Down
2 changes: 1 addition & 1 deletion src/lv_i18n.template.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ int lv_i18n_set_locale(const char * l_name)
}


static const char * __lv_i18n_get_text_core(lv_i18n_phrase_t * trans, const char * msg_id)
static const char * __lv_i18n_get_text_core(const lv_i18n_phrase_t * trans, const char * msg_id)
{
uint16_t i;
for(i = 0; trans[i].msg_id != NULL; i++) {
Expand Down

0 comments on commit 8904107

Please sign in to comment.