Răsfoiți Sursa

libobs: Add obs_module_get_string helper function

Allows getting a translated string for the current module, returning
false if no string available.
jp9000 9 ani în urmă
părinte
comite
988bbc6080
1 a modificat fișierele cu 9 adăugiri și 0 ștergeri
  1. 9 0
      libobs/obs-module.h

+ 9 - 0
libobs/obs-module.h

@@ -112,6 +112,10 @@ MODULE_EXPORT void obs_module_free_locale(void);
 		text_lookup_getstr(obs_module_lookup, val, &out); \
 		return out; \
 	} \
+	bool obs_module_get_string(const char *val, const char **out) \
+	{ \
+		return text_lookup_getstr(obs_module_lookup, val, out); \
+	} \
 	void obs_module_set_locale(const char *locale) \
 	{ \
 		if (obs_module_lookup) text_lookup_destroy(obs_module_lookup); \
@@ -127,6 +131,11 @@ MODULE_EXPORT void obs_module_free_locale(void);
 /** Helper function for looking up locale if default locale handler was used */
 MODULE_EXTERN const char *obs_module_text(const char *lookup_string);
 
+/** Helper function for looking up locale if default locale handler was used,
+ * returns true if text found, otherwise false */
+MODULE_EXTERN bool obs_module_get_string(const char *lookup_string,
+		const char **translated_string);
+
 /** Helper function that returns the current module */
 MODULE_EXTERN obs_module_t *obs_current_module(void);