obs-frontend-api: Add function to get frontend translated string
Developers now can easily get a translated string from the frontend instead of using their own translations.
This commit is contained in:
parent
b7ab8cf838
commit
65a360fa41
@ -620,6 +620,11 @@ struct OBSStudioAPI : obs_frontend_callbacks {
|
|||||||
return bstrdup(recordOutputPath);
|
return bstrdup(recordOutputPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *obs_frontend_get_locale_string(const char *string) override
|
||||||
|
{
|
||||||
|
return Str(string);
|
||||||
|
}
|
||||||
|
|
||||||
void on_load(obs_data_t *settings) override
|
void on_load(obs_data_t *settings) override
|
||||||
{
|
{
|
||||||
for (size_t i = saveCallbacks.size(); i > 0; i--) {
|
for (size_t i = saveCallbacks.size(); i > 0; i--) {
|
||||||
|
@ -559,3 +559,9 @@ char *obs_frontend_get_current_record_output_path(void)
|
|||||||
? c->obs_frontend_get_current_record_output_path()
|
? c->obs_frontend_get_current_record_output_path()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *obs_frontend_get_locale_string(const char *string)
|
||||||
|
{
|
||||||
|
return !!callbacks_valid() ? c->obs_frontend_get_locale_string(string)
|
||||||
|
: nullptr;
|
||||||
|
}
|
||||||
|
@ -225,6 +225,7 @@ EXPORT void obs_frontend_open_source_filters(obs_source_t *source);
|
|||||||
EXPORT void obs_frontend_open_source_interaction(obs_source_t *source);
|
EXPORT void obs_frontend_open_source_interaction(obs_source_t *source);
|
||||||
|
|
||||||
EXPORT char *obs_frontend_get_current_record_output_path(void);
|
EXPORT char *obs_frontend_get_current_record_output_path(void);
|
||||||
|
EXPORT const char *obs_frontend_get_locale_string(const char *string);
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
@ -142,6 +142,8 @@ struct obs_frontend_callbacks {
|
|||||||
obs_frontend_open_source_interaction(obs_source_t *source) = 0;
|
obs_frontend_open_source_interaction(obs_source_t *source) = 0;
|
||||||
|
|
||||||
virtual char *obs_frontend_get_current_record_output_path(void) = 0;
|
virtual char *obs_frontend_get_current_record_output_path(void) = 0;
|
||||||
|
virtual const char *
|
||||||
|
obs_frontend_get_locale_string(const char *string) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
EXPORT void
|
EXPORT void
|
||||||
|
@ -768,3 +768,9 @@ Functions
|
|||||||
|
|
||||||
:return: A new pointer to the current record output path. Free
|
:return: A new pointer to the current record output path. Free
|
||||||
with :c:func:`bfree()`
|
with :c:func:`bfree()`
|
||||||
|
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
.. function:: const char *obs_frontend_get_locale_string(const char *string)
|
||||||
|
|
||||||
|
:return: Gets the frontend translation of a given string.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user