tweaks an locale updates

This commit is contained in:
GenevensiS
2026-02-16 13:49:14 +01:00
parent 46414307fd
commit adccdef933
26 changed files with 630 additions and 90 deletions
+2 -2
View File
@@ -197,11 +197,11 @@ bool KeywordReminderTextValue::checkScript(const ScriptP& script) {
// ----------------------------------------------------------------------------- : Changing keywords : mode
ChangeKeywordModeAction::ChangeKeywordModeAction(Keyword& keyword, const String& new_mode)
: keyword(keyword), mode(new_mode)
: keyword(keyword), mode(new_mode)
{}
String ChangeKeywordModeAction::getName(bool to_undo) const {
return _("Keyword mode");
return _ACTION_("keyword mode");
}
void ChangeKeywordModeAction::perform(bool to_undo) {
+14 -12
View File
@@ -57,7 +57,6 @@ AddCardAction::AddCardAction(AddingOrRemoving ar, Set& set, const vector<CardP>&
LINK_PAIRS(linked_pairs, added_card);
FOR_EACH(linked_pair, linked_pairs) {
String& linked_uid = linked_pair.first.get();
String& linked_relation = linked_pair.second.get();
if (linked_uid.empty()) continue;
// If it's an added card, replace the link
if (all_added_uids.find(linked_uid) != all_added_uids.end()) {
@@ -99,7 +98,7 @@ ReorderCardsAction::ReorderCardsAction(Set& set, size_t card_id1, size_t card_id
{}
String ReorderCardsAction::getName(bool to_undo) const {
return _("Reorder cards");
return _ACTION_("reorder cards");
}
void ReorderCardsAction::perform(bool to_undo) {
@@ -120,31 +119,34 @@ OneWayLinkCardsAction::OneWayLinkCardsAction(Set& set, CardP& card, const String
: CardListAction(set), card(card), uid(uid), relation(relation)
{
switch (index) {
case 1: {
case 0: {
linked_uid = &card->linked_card_1;
linked_relation = &card->linked_relation_1;
return;
}
case 2: {
case 1: {
linked_uid = &card->linked_card_2;
linked_relation = &card->linked_relation_2;
return;
}
case 3: {
case 2: {
linked_uid = &card->linked_card_3;
linked_relation = &card->linked_relation_3;
return;
}
default: {
case 3: {
linked_uid = &card->linked_card_4;
linked_relation = &card->linked_relation_4;
return;
}
default: {
throw ScriptError(_("OneWayLinkCardsAction created with invalid index"));
}
}
}
String OneWayLinkCardsAction::getName(bool to_undo) const {
return _("Change link");
return _ACTION_("change link");
}
void OneWayLinkCardsAction::perform(bool to_undo) {
@@ -167,7 +169,7 @@ ChangeCardStyleAction::ChangeCardStyleAction(const CardP& card, const StyleSheet
: card(card), stylesheet(stylesheet), has_styling(false) // styling_data(empty)
{}
String ChangeCardStyleAction::getName(bool to_undo) const {
return _("Change style");
return _ACTION_("change style");
}
void ChangeCardStyleAction::perform(bool to_undo) {
swap(card->stylesheet, stylesheet);
@@ -180,7 +182,7 @@ ChangeSetStyleAction::ChangeSetStyleAction(Set& set, const CardP& card)
: set(set), card(card)
{}
String ChangeSetStyleAction::getName(bool to_undo) const {
return _("Change style (all cards)");
return _ACTION_("change all styles");
}
void ChangeSetStyleAction::perform(bool to_undo) {
if (!to_undo) {
@@ -216,7 +218,7 @@ ChangeCardHasStylingAction::ChangeCardHasStylingAction(Set& set, const CardP& ca
}
}
String ChangeCardHasStylingAction::getName(bool to_undo) const {
return _("Use custom style");
return _ACTION_("use custom style");
}
void ChangeCardHasStylingAction::perform(bool to_undo) {
card->has_styling = !card->has_styling;
@@ -229,7 +231,7 @@ ChangeCardNotesAction::ChangeCardNotesAction(const CardP& card, const String& no
: card(card), notes(notes)
{}
String ChangeCardNotesAction::getName(bool to_undo) const {
return _("Change notes");
return _ACTION_("change notes");
}
void ChangeCardNotesAction::perform(bool to_undo) {
swap(card->notes, notes);
@@ -241,7 +243,7 @@ ChangeCardUIDAction::ChangeCardUIDAction(Set& set, const CardP& card, const Stri
: CardListAction(set), card(card), uid(uid)
{}
String ChangeCardUIDAction::getName(bool to_undo) const {
return _("Change ID");
return _ACTION_("change id");
}
void ChangeCardUIDAction::perform(bool to_undo) {
FOR_EACH(c, set.cards) {
+11 -5
View File
@@ -334,7 +334,7 @@ TextToggleReminderAction::TextToggleReminderAction(const TextValueP& value, size
old = enable ? _('1') : _('0');
}
String TextToggleReminderAction::getName(bool to_undo) const {
return enable ? _("Show reminder text") : _("Hide reminder text");
return enable ? _ACTION_("show reminder text") : _ACTION_("hide reminder text");
}
void TextToggleReminderAction::perform(bool to_undo) {
@@ -375,12 +375,18 @@ void ScriptStyleEvent::perform(bool) {
// ----------------------------------------------------------------------------- : Bulk action
BulkAction::BulkAction(const vector<ActionP>& actions, const SetP& set, CardListBase* card_list_window)
BulkAction::BulkAction(const vector<ActionP>& actions, const SetP& set, CardListBase* card_list_window, bool change_name)
: actions(actions), set(set), card_list_window(card_list_window)
{
if (actions.empty()) throw ScriptError(_("BulkAction created with no actions"));
name_do = _ACTION_1_("bulk", actions.front()->getName(false));
name_undo = _ACTION_1_("bulk", actions.front()->getName(true));
if (actions.empty()) throw ScriptError(_("BulkAction created with no actions"));
if (change_name) {
name_do = _ACTION_1_("bulk", actions.front()->getName(false));
name_undo = _ACTION_1_("bulk", actions.front()->getName(true));
}
else {
name_do = actions.front()->getName(false);
name_undo = actions.front()->getName(true);
}
}
BulkAction::~BulkAction() {}
+1 -1
View File
@@ -214,7 +214,7 @@ public:
// An action that's just a list of other actions
class BulkAction : public Action {
public:
BulkAction(const vector<ActionP>& actions, const SetP& set, CardListBase* card_list_window);
BulkAction(const vector<ActionP>& actions, const SetP& set, CardListBase* card_list_window, bool change_name);
~BulkAction() override;
String getName(bool to_undo) const override;
+13 -11
View File
@@ -76,7 +76,7 @@ vector<int> Card::findFreeLinks(vector<String>& linked_uids, const unordered_set
for (int j = 0; j < linked_pairs.size(); ++j) {
auto& linked_pair = linked_pairs[j];
if (linked_pair.first.get() == linked_uid &&
std::find(freeIndexes.begin(), freeIndexes.end(), j) != freeIndexes.end()
std::find(freeIndexes.begin(), freeIndexes.end(), j) == freeIndexes.end()
) {
freeIndexes.push_back(j);
goto continue_outer;
@@ -86,7 +86,7 @@ vector<int> Card::findFreeLinks(vector<String>& linked_uids, const unordered_set
for (int j = 0; j < linked_pairs.size(); ++j) {
auto& linked_pair = linked_pairs[j];
if (linked_pair.first.get().empty() &&
std::find(freeIndexes.begin(), freeIndexes.end(), j) != freeIndexes.end()
std::find(freeIndexes.begin(), freeIndexes.end(), j) == freeIndexes.end()
) {
freeIndexes.push_back(j);
goto continue_outer;
@@ -96,7 +96,7 @@ vector<int> Card::findFreeLinks(vector<String>& linked_uids, const unordered_set
for (int j = 0; j < linked_pairs.size(); ++j) {
auto& linked_pair = linked_pairs[j];
if (all_existing_uids.find(linked_pair.first.get()) == all_existing_uids.end() &&
std::find(freeIndexes.begin(), freeIndexes.end(), j) != freeIndexes.end()
std::find(freeIndexes.begin(), freeIndexes.end(), j) == freeIndexes.end()
) {
freeIndexes.push_back(j);
goto continue_outer;
@@ -131,18 +131,20 @@ vector<int> Card::findRelationLinks(const String& linked_relation) {
String& Card::getLinkedUID(int index) {
switch (index) {
case 3: return linked_card_4;
case 2: return linked_card_3;
case 0: return linked_card_1;
case 1: return linked_card_2;
default: return linked_card_1;
case 2: return linked_card_3;
case 3: return linked_card_4;
default: throw ScriptError(_("getLinkedUID called with invalid index"));
}
}
String& Card::getLinkedRelation(int index) {
switch (index) {
case 3: return linked_relation_4;
case 2: return linked_relation_3;
case 0: return linked_relation_1;
case 1: return linked_relation_2;
default: return linked_relation_1;
case 2: return linked_relation_3;
case 3: return linked_relation_4;
default: throw ScriptError(_("getLinkedRelation called with invalid index"));
}
}
@@ -215,7 +217,7 @@ void Card::addLink(const Set& set, CardP& linked_card, const String& selected_re
return;
}
getLinkedUID(index) = linked_card->uid;
getLinkedRelation(index) = selected_relation;
getLinkedRelation(index) = linked_relation;
index = linked_card->findFreeLink(uid, all_existing_uids);
if (index < 0) {
@@ -223,7 +225,7 @@ void Card::addLink(const Set& set, CardP& linked_card, const String& selected_re
}
else {
linked_card->getLinkedUID(index) = uid;
linked_card->getLinkedRelation(index) = linked_relation;
linked_card->getLinkedRelation(index) = selected_relation;
}
}