Skip to content

Commit 3294927

Browse files
committed
get rid of _exvGettext
No real point to it as the logic is macro'd out anyway. Signed-off-by: Rosen Penev <[email protected]>
1 parent 89de153 commit 3294927

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

src/i18n.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
#ifdef EXV_ENABLE_NLS
3333
#include "types.hpp"
3434

35-
// Definition is in types.cpp
36-
const char* _exvGettext(const char* str);
37-
3835
#define _(String) Exiv2::exvGettext(String)
3936
#define N_(String) String
4037

src/types.cpp

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,24 @@ int exifTime(const char* buf, tm* tm) {
534534

535535
const char* exvGettext(const char* str) {
536536
#ifdef EXV_ENABLE_NLS
537-
return _exvGettext(str);
537+
static bool exvGettextInitialized = false;
538+
539+
if (!exvGettextInitialized) {
540+
// bindtextdomain(EXV_PACKAGE_NAME, EXV_LOCALEDIR);
541+
auto localeDir = []() -> std::string {
542+
fs::path ret = EXV_LOCALEDIR;
543+
if constexpr (EXV_LOCALEDIR[0] != '/')
544+
ret = fs::path(Exiv2::getProcessPath()) / EXV_LOCALEDIR;
545+
return ret.string();
546+
}();
547+
bindtextdomain(EXV_PACKAGE_NAME, localeDir.c_str());
548+
#ifdef EXV_HAVE_BIND_TEXTDOMAIN_CODESET
549+
bind_textdomain_codeset(EXV_PACKAGE_NAME, "UTF-8");
550+
#endif
551+
exvGettextInitialized = true;
552+
}
553+
554+
return dgettext(EXV_PACKAGE_NAME, str);
538555
#else
539556
return str;
540557
#endif
@@ -660,27 +677,3 @@ Rational floatToRationalCast(float f) {
660677
}
661678

662679
} // namespace Exiv2
663-
664-
#ifdef EXV_ENABLE_NLS
665-
// Declaration is in i18n.h
666-
const char* _exvGettext(const char* str) {
667-
static bool exvGettextInitialized = false;
668-
669-
if (!exvGettextInitialized) {
670-
// bindtextdomain(EXV_PACKAGE_NAME, EXV_LOCALEDIR);
671-
auto localeDir = []() -> std::string {
672-
fs::path ret = EXV_LOCALEDIR;
673-
if constexpr (EXV_LOCALEDIR[0] != '/')
674-
ret = fs::path(Exiv2::getProcessPath()) / EXV_LOCALEDIR;
675-
return ret.string();
676-
}();
677-
bindtextdomain(EXV_PACKAGE_NAME, localeDir.c_str());
678-
#ifdef EXV_HAVE_BIND_TEXTDOMAIN_CODESET
679-
bind_textdomain_codeset(EXV_PACKAGE_NAME, "UTF-8");
680-
#endif
681-
exvGettextInitialized = true;
682-
}
683-
684-
return dgettext(EXV_PACKAGE_NAME, str);
685-
}
686-
#endif // EXV_ENABLE_NLS

0 commit comments

Comments
 (0)