Skip to content

Commit

Permalink
Fix accelerator key check for extended ASCII langs under UNIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake-Madden committed Dec 8, 2024
1 parent 6c5e347 commit 9616438
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/i18n_review.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ namespace i18n_check
const std::wregex i18n_review::m_1word_regex{
LR"((\b|\s|^)([[:alpha:]_ŽžŸÀ-ÖØ-öø-ÿżźćńółęąśŻŹĆĄŚĘŁÓŃěščřžýáíéóúůďťňĎŇŤŠČŘŽÝÁÍÉÚŮĚÓАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя&'\.@]+)(2D|3D)?(\b|\s|$))"
};
const std::wregex i18n_review::m_keyboard_accelerator_regex{
LR"(&[[:alpha:]_ŽžŸÀ-ÖØ-öø-ÿżźćńółęąśŻŹĆĄŚĘŁÓŃěščřžýáíéóúůďťňĎŇŤŠČŘŽÝÁÍÉÚŮĚÓАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя])"
};
// cuneiform-suppress-end
const std::wregex i18n_review::m_hashtag_regex{ LR"(#[[:alnum:]]{2,})" };
const std::wregex i18n_review::m_key_shortcut_regex{
Expand Down
1 change: 1 addition & 0 deletions src/i18n_review.h
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,7 @@ namespace i18n_check
static const std::wregex m_angle_braced_one_word_regex;
static const std::wregex m_2letter_regex;
static const std::wregex m_1word_regex;
static const std::wregex m_keyboard_accelerator_regex;
static const std::wregex m_hashtag_regex;
static const std::wregex m_key_shortcut_regex;
static const std::wregex m_function_signature_regex;
Expand Down
12 changes: 5 additions & 7 deletions src/translation_catalog_review.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ namespace i18n_check

if (static_cast<bool>(m_review_styles & check_accelerators))
{
const std::wregex keyboardAcceleratorRegex{ L"&[[:alnum:]]" };

if (!catEntry.second.m_translation.empty())
{
srcResults.clear();
Expand All @@ -187,13 +185,13 @@ namespace i18n_check
std::wstring::const_iterator searchTransStart(
catEntry.second.m_translation.cbegin());
while (std::regex_search(searchSrcStart, catEntry.second.m_source.cend(),
reMatches, keyboardAcceleratorRegex))
reMatches, m_keyboard_accelerator_regex))
{
srcResults.push_back(reMatches[0]);
searchSrcStart = reMatches.suffix().first;
}
while (std::regex_search(searchTransStart, catEntry.second.m_translation.cend(),
reMatches, keyboardAcceleratorRegex))
reMatches, m_keyboard_accelerator_regex))
{
transResults.push_back(reMatches[0]);
searchTransStart = reMatches.suffix().first;
Expand All @@ -219,14 +217,14 @@ namespace i18n_check
std::wstring::const_iterator searchTransStart(
catEntry.second.m_translation_plural.cbegin());
while (std::regex_search(searchSrcStart, catEntry.second.m_source_plural.cend(),
reMatches, keyboardAcceleratorRegex))
reMatches, m_keyboard_accelerator_regex))
{
srcResults.push_back(reMatches[0]);
searchSrcStart = reMatches.suffix().first;
}
while (std::regex_search(searchTransStart,
catEntry.second.m_translation_plural.cend(),
reMatches, keyboardAcceleratorRegex))
catEntry.second.m_translation_plural.cend(), reMatches,
m_keyboard_accelerator_regex))
{
transResults.push_back(reMatches[0]);
searchTransStart = reMatches.suffix().first;
Expand Down

0 comments on commit 9616438

Please sign in to comment.