Skip to content

Commit 0d4ad97

Browse files
committed
V2025.7.3
1 parent 332a9ff commit 0d4ad97

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 2025.7.3
4+
### Breaking Changes
5+
None
6+
### New APIs
7+
#### Localization
8+
- You can now specify "C" in the `Gettext::changeLanguage()` function to turn off translations.
9+
### Fixes
10+
#### Localization
11+
- Improved `Gettext::getAvailableLanguages()`'s search for languages
12+
313
## 2025.7.2
414
### Breaking Changes
515
None

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ endif()
2020
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
2121

2222
#libnick Definition
23-
project ("libnick" LANGUAGES C CXX VERSION 2025.7.2 DESCRIPTION "A cross-platform base for native Nickvision applications.")
23+
project ("libnick" LANGUAGES C CXX VERSION 2025.7.3 DESCRIPTION "A cross-platform base for native Nickvision applications.")
2424
include(CMakePackageConfigHelpers)
2525
include(GNUInstallDirs)
2626
include(CTest)

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "libnick"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = "2025.7.2"
51+
PROJECT_NUMBER = "2025.7.3"
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

include/localization/gettext.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ namespace Nickvision::Localization::Gettext
5151
const std::string& getDomainName();
5252
/**
5353
* @brief Gets the list of available translated languages.
54+
* @brief Does not include the "C" language (the default language).
5455
* @return The list of available translated languages.
5556
*/
5657
const std::vector<std::string>& getAvailableLanguages();
5758
/**
5859
* @brief Changes the current language for gettext translations.
59-
* @param language The language code to change translations to
60+
* @param language The language code to change translations to (use "C" to turn off translations and use the default language)
6061
* @return True if the language was changed successfully, else false
6162
*/
6263
bool changeLanguage(const std::string& language);

manual/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66

77
libnick provides Nickvision apps with a common set of cross-platform APIs for managing system and desktop app functionality such as network management, taskbar icons, translations, app updates, and more.
88

9-
## 2025.7.2
9+
## 2025.7.3
1010
### Breaking Changes
1111
None
1212
### New APIs
1313
#### Localization
14-
- Added `Gettext::changeLanguage()` function
14+
- You can now specify "C" in the `Gettext::changeLanguage()` function to turn off translations.
1515
### Fixes
16-
None
16+
#### Localization
17+
- Improved `Gettext::getAvailableLanguages()`'s search for languages
1718

1819
## Dependencies
1920
The following are a list of dependencies used by libnick.

src/localization/gettext.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,24 @@ namespace Nickvision::Localization
4444
{
4545
for (const std::filesystem::directory_entry& e : std::filesystem::directory_iterator(Environment::getExecutableDirectory()))
4646
{
47-
if (e.is_directory() && std::filesystem::exists(e.path() / (getDomainName() + ".mo")))
47+
if (e.is_directory() && std::filesystem::exists(e.path() / "LC_MESSAGES" / (getDomainName() + ".mo")))
4848
{
4949
langs.push_back(e.path().filename().string());
5050
}
5151
}
52+
std::sort(langs.begin(), langs.end());
5253
}
5354
return langs;
5455
}
5556

5657
bool Gettext::changeLanguage(const std::string& language)
5758
{
59+
if(language == "C")
60+
{
61+
Environment::setVariable("LANGUAGE", "");
62+
setlocale(LC_ALL, "C");
63+
return true;
64+
}
5865
const std::vector<std::string>& langs{ Gettext::getAvailableLanguages() };
5966
if (std::find(langs.begin(), langs.end(), language) == langs.end())
6067
{

0 commit comments

Comments
 (0)