Skip to content

Commit 332a9ff

Browse files
committed
V2025.7.2
1 parent b97b9a8 commit 332a9ff

File tree

6 files changed

+32
-6
lines changed

6 files changed

+32
-6
lines changed

CHANGELOG.md

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

3+
## 2025.7.2
4+
### Breaking Changes
5+
None
6+
### New APIs
7+
#### Localization
8+
- Added `Gettext::changeLanguage()` function
9+
### Fixes
10+
None
11+
312
## 2025.7.1
413
### Breaking Changes
514
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.1 DESCRIPTION "A cross-platform base for native Nickvision applications.")
23+
project ("libnick" LANGUAGES C CXX VERSION 2025.7.2 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.1"
51+
PROJECT_NUMBER = "2025.7.2"
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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ namespace Nickvision::Localization::Gettext
5454
* @return The list of available translated languages.
5555
*/
5656
const std::vector<std::string>& getAvailableLanguages();
57+
/**
58+
* @brief Changes the current language for gettext translations.
59+
* @param language The language code to change translations to
60+
* @return True if the language was changed successfully, else false
61+
*/
62+
bool changeLanguage(const std::string& language);
5763
/**
5864
* @brief Translates a message and formats it with the given arguments.
5965
* @param msg The message to translate

manual/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
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.1
9+
## 2025.7.2
1010
### Breaking Changes
1111
None
1212
### New APIs
13-
None
13+
#### Localization
14+
- Added `Gettext::changeLanguage()` function
1415
### Fixes
15-
#### Helpers
16-
- Fixed an issue where `StringHelpers::isValidUrl()` did not work correctly
16+
None
1717

1818
## Dependencies
1919
The following are a list of dependencies used by libnick.

src/localization/gettext.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ namespace Nickvision::Localization
5353
return langs;
5454
}
5555

56+
bool Gettext::changeLanguage(const std::string& language)
57+
{
58+
const std::vector<std::string>& langs{ Gettext::getAvailableLanguages() };
59+
if (std::find(langs.begin(), langs.end(), language) == langs.end())
60+
{
61+
return false;
62+
}
63+
Environment::setVariable("LANGUAGE", language);
64+
return true;
65+
}
66+
5667
const char* Gettext::pgettext(const char* context, const char* msg)
5768
{
5869
const char* translation{ dcgettext(s_domainName.c_str(), context, LC_MESSAGES) };

0 commit comments

Comments
 (0)