@@ -534,7 +534,24 @@ int exifTime(const char* buf, tm* tm) {
534534
535535const 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