Skip to content

Commit

Permalink
[widget] add some translation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpoelen committed Nov 13, 2024
1 parent 21e481a commit 6de34f9
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 15 deletions.
13 changes: 6 additions & 7 deletions src/acl/module_manager/mod_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void ModFactory::create_valid_message_mod()
{
chars_view ok_text = TR(trkeys::accepted, language(this->ini));
chars_view cancel = TR(trkeys::refused, language(this->ini));
chars_view caption = "Information"_av;
chars_view caption = TR(trkeys::information, language(this->ini));
auto mod_pack = Impl::create_dialog(*this, ok_text, cancel, caption);
Impl::set_mod(*this, ModuleName::valid, mod_pack, false);
}
Expand All @@ -367,14 +367,14 @@ void ModFactory::create_display_message_mod()
{
chars_view ok_text = TR(trkeys::OK, language(this->ini));
chars_view cancel = nullptr;
chars_view caption = "Information"_av;
chars_view caption = TR(trkeys::information, language(this->ini));
auto mod_pack = Impl::create_dialog(*this, ok_text, cancel, caption);
Impl::set_mod(*this, ModuleName::confirm, mod_pack, false);
}

void ModFactory::create_dialog_challenge_mod()
{
chars_view caption = "Challenge"_av;
chars_view caption = TR(trkeys::challenge, language(this->ini));
const auto challenge = this->ini.get<cfg::context::authentication_challenge>()
? DialogWithChallengeMod::ChallengeOpt::Echo
: DialogWithChallengeMod::ChallengeOpt::Hide;
Expand All @@ -398,18 +398,17 @@ void ModFactory::create_dialog_challenge_mod()

void ModFactory::create_display_link_mod()
{
chars_view caption = "URL Redirection"_av;
chars_view link_label = "Copy to clipboard: "_av;
auto new_mod = new WidgetDialogWithCopyableLinkMod(
this->ini,
this->graphics,
this->client_info.screen_info.width,
this->client_info.screen_info.height,
this->rail_client_execute.adjust_rect(this->client_info.get_widget_rect()),
caption,
TR(trkeys::link_caption, language(ini)),
this->ini.get<cfg::context::message>(),
this->ini.get<cfg::context::display_link>(),
link_label,
TR(trkeys::link_label, language(ini)),
TR(trkeys::link_copied, language(ini)),
this->rail_client_execute,
this->glyphs,
this->theme,
Expand Down
5 changes: 2 additions & 3 deletions src/mod/internal/dialog_mod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ WidgetDialogWithCopyableLinkMod::WidgetDialogWithCopyableLinkMod(
gdi::GraphicApi & drawable,
uint16_t width, uint16_t height,
Rect const widget_rect, chars_view caption, chars_view message,
chars_view link_value, chars_view link_label,
chars_view link_value, chars_view link_label, chars_view copied_msg_label,
ClientExecute & rail_client_execute,
Font const& font, Theme const& theme, CopyPaste& copy_paste
)
Expand All @@ -138,8 +138,7 @@ WidgetDialogWithCopyableLinkMod::WidgetDialogWithCopyableLinkMod(
this->set_mod_signal(BACK_EVENT_NEXT);
}
},
caption, message, link_value, link_label,
TR(trkeys::link_copied, language(vars)),
caption, message, link_value, link_label, copied_msg_label,
TR(trkeys::OK, language(vars)),
font, theme, copy_paste)
, vars(vars)
Expand Down
2 changes: 1 addition & 1 deletion src/mod/internal/dialog_mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class WidgetDialogWithCopyableLinkMod : public RailInternalModBase
gdi::GraphicApi & drawable,
uint16_t width, uint16_t height,
Rect const widget_rect, chars_view caption, chars_view message,
chars_view link_value, chars_view link_label,
chars_view link_value, chars_view link_label, chars_view copied_msg_label,
ClientExecute & rail_client_execute,
Font const& font, Theme const& theme, CopyPaste& copy_paste);

Expand Down
7 changes: 6 additions & 1 deletion src/utils/trkeys.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ namespace trkeys
TR_KV(accepted, "I accept");
TR_KV(refused, "I decline");

// ModuleName::link_confirm / WidgetDialogWithCopyableLink
// ModuleName::challenge
TR_KV(challenge, "Challenge");

// ModuleName::link_confirm
TR_KV(link_caption, "URL Redirection");
TR_KV(link_label, "Copy to clipboard: ");
TR_KV(link_copied, "The link is copied.");

#undef TR_KV
Expand Down
18 changes: 17 additions & 1 deletion tools/i18n/po/en/redemption.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-20 15:39+0200\n"
"POT-Creation-Date: 2024-11-13 16:20+0100\n"
"PO-Revision-Date: 2021-03-01 14:06+0100\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
Expand Down Expand Up @@ -505,3 +505,19 @@ msgstr ""
#: src/utils/trkeys.hpp:213
msgid "I decline"
msgstr ""

#: src/utils/trkeys.hpp:216
msgid "Challenge"
msgstr ""

#: src/utils/trkeys.hpp:219
msgid "URL Redirection"
msgstr ""

#: src/utils/trkeys.hpp:220
msgid "Copy to clipboard: "
msgstr ""

#: src/utils/trkeys.hpp:221
msgid "The link is copied."
msgstr ""
18 changes: 17 additions & 1 deletion tools/i18n/po/fr/redemption.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-20 15:39+0200\n"
"POT-Creation-Date: 2024-11-13 16:20+0100\n"
"PO-Revision-Date: 2021-03-01 15:52+0100\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
Expand Down Expand Up @@ -522,3 +522,19 @@ msgstr "J'accepte"
#: src/utils/trkeys.hpp:213
msgid "I decline"
msgstr "Je refuse"

#: src/utils/trkeys.hpp:216
msgid "Challenge"
msgstr ""

#: src/utils/trkeys.hpp:219
msgid "URL Redirection"
msgstr ""

#: src/utils/trkeys.hpp:220
msgid "Copy to clipboard: "
msgstr ""

#: src/utils/trkeys.hpp:221
msgid "The link is copied."
msgstr ""
18 changes: 17 additions & 1 deletion tools/i18n/po/redemption.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-06-20 15:39+0200\n"
"POT-Creation-Date: 2024-11-13 16:20+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -546,3 +546,19 @@ msgstr ""
#: src/utils/trkeys.hpp:213
msgid "I decline"
msgstr ""

#: src/utils/trkeys.hpp:216
msgid "Challenge"
msgstr ""

#: src/utils/trkeys.hpp:219
msgid "URL Redirection"
msgstr ""

#: src/utils/trkeys.hpp:220
msgid "Copy to clipboard: "
msgstr ""

#: src/utils/trkeys.hpp:221
msgid "The link is copied."
msgstr ""

0 comments on commit 6de34f9

Please sign in to comment.