From c3122fb82f52420e5d07706817b9520ac7cb145c Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 7 Oct 2021 04:41:06 +0200 Subject: [PATCH] added [lang] ezc function for returning a localized string --- winixd/templates/templates.cpp | 1 + winixd/templates/templates.h | 3 +++ winixd/templates/winix.cpp | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/winixd/templates/templates.cpp b/winixd/templates/templates.cpp index 3aef0d7..a61973d 100644 --- a/winixd/templates/templates.cpp +++ b/winixd/templates/templates.cpp @@ -644,6 +644,7 @@ void Templates::CreateFunctions() ezc_functions.Insert("winix_locale_tab_name", winix_locale_tab_name); ezc_functions.Insert("winix_is_htmx_request", winix_is_htmx_request); + ezc_functions.Insert("lang", lang); /* who diff --git a/winixd/templates/templates.h b/winixd/templates/templates.h index eb45cb4..f47bf95 100644 --- a/winixd/templates/templates.h +++ b/winixd/templates/templates.h @@ -365,6 +365,7 @@ namespace TemplatesFunctions void ls_ckeditor_funnum_browse(Info & i); + /* privileges */ @@ -536,6 +537,8 @@ namespace TemplatesFunctions void winix_locale_tab_name(Info & i); void winix_is_htmx_request(Info & i); + void lang(Info & i); // defined in winix.cpp - MOVE ME to a better place + /* who */ diff --git a/winixd/templates/winix.cpp b/winixd/templates/winix.cpp index 823e365..fcaf57b 100644 --- a/winixd/templates/winix.cpp +++ b/winixd/templates/winix.cpp @@ -381,6 +381,15 @@ void winix_is_htmx_request(Info & i) } +void lang(Info & i) +{ + i.res = !i.par.empty(); + + if( i.res ) + i.out << locale.Get(i.par); +} + + } // namespace