diff --git a/build/data/obs-plugins/image-source/locale/en-US.ini b/build/data/obs-plugins/image-source/locale/en-US.ini
new file mode 100644
index 000000000..fc453ae82
--- /dev/null
+++ b/build/data/obs-plugins/image-source/locale/en-US.ini
@@ -0,0 +1,2 @@
+ImageInput="Image"
+File="Image File"
diff --git a/build/data/obs-plugins/linux-pulseaudio/locale/en-US.ini b/build/data/obs-plugins/linux-pulseaudio/locale/en-US.ini
new file mode 100644
index 000000000..8b3c57c3c
--- /dev/null
+++ b/build/data/obs-plugins/linux-pulseaudio/locale/en-US.ini
@@ -0,0 +1,3 @@
+PulseInput="Audio Input Capture (PulseAudio)"
+PulseOutput="Audio Output Capture (PulseAudio)"
+Device="Device"
diff --git a/build/data/obs-plugins/linux-v4l2/locale/en-US.ini b/build/data/obs-plugins/linux-v4l2/locale/en-US.ini
new file mode 100644
index 000000000..e5c578845
--- /dev/null
+++ b/build/data/obs-plugins/linux-v4l2/locale/en-US.ini
@@ -0,0 +1,5 @@
+V4L2Input="Video Capture Device (V4L2)"
+Device="Device"
+ImageFormat="Video Format"
+Resolution="Resolution"
+FrameRate="Frame Rate"
diff --git a/build/data/obs-plugins/linux-xcomposite/locale/en-US.ini b/build/data/obs-plugins/linux-xcomposite/locale/en-US.ini
new file mode 100644
index 000000000..fb3acc32c
--- /dev/null
+++ b/build/data/obs-plugins/linux-xcomposite/locale/en-US.ini
@@ -0,0 +1,8 @@
+XCCapture="Xcomposite Capture"
+Window="Window"
+CropTop="Crop Top (pixels)"
+CropLeft="Crop Left (pixels)"
+CropRight="Crop Right (pixels)"
+CropBottom="Crop Bottom (pixels)"
+SwapRedBlue="Swap red and blue"
+LockX="Lock X server when capturing"
diff --git a/build/data/obs-plugins/linux-xshm/locale/en-US.ini b/build/data/obs-plugins/linux-xshm/locale/en-US.ini
new file mode 100644
index 000000000..07c0523f6
--- /dev/null
+++ b/build/data/obs-plugins/linux-xshm/locale/en-US.ini
@@ -0,0 +1,3 @@
+X11SharedMemoryScreenInput="X11 Shared Memory Screen Input"
+Screen="Screen"
+CaptureCursor="Capture Cursor"
diff --git a/build/data/obs-plugins/mac-avcapture/locale/en-US.ini b/build/data/obs-plugins/mac-avcapture/locale/en-US.ini
new file mode 100644
index 000000000..1989133d4
--- /dev/null
+++ b/build/data/obs-plugins/mac-avcapture/locale/en-US.ini
@@ -0,0 +1,4 @@
+AVCapture="Video Capture Device"
+Device="Device"
+UsePreset="Use Preset"
+Preset="Preset"
diff --git a/build/data/obs-plugins/mac-capture/locale/en-US.ini b/build/data/obs-plugins/mac-capture/locale/en-US.ini
new file mode 100644
index 000000000..d222c6ae5
--- /dev/null
+++ b/build/data/obs-plugins/mac-capture/locale/en-US.ini
@@ -0,0 +1,7 @@
+CoreAudio.InputCapture="Audio Input Capture"
+CoreAudio.OutputCapture="Audio Output Capture"
+CoreAudio.Device="Device"
+CoreAudio.Device.Default="Default"
+DisplayCapture="Display Capture"
+DisplayCapture.Display="Display"
+DisplayCapture.ShowCursor="Show Cursor"
diff --git a/build/data/obs-plugins/obs-ffmpeg/locale/en-US.ini b/build/data/obs-plugins/obs-ffmpeg/locale/en-US.ini
new file mode 100644
index 000000000..e34a28690
--- /dev/null
+++ b/build/data/obs-plugins/obs-ffmpeg/locale/en-US.ini
@@ -0,0 +1,3 @@
+FFmpegOutput="FFmpeg Output"
+FFmpegAAC="FFmpeg Default AAC Encoder"
+Bitrate="Bitrate"
diff --git a/build/data/obs-plugins/obs-libfdk/locale/en-US.ini b/build/data/obs-plugins/obs-libfdk/locale/en-US.ini
new file mode 100644
index 000000000..cdf5f8603
--- /dev/null
+++ b/build/data/obs-plugins/obs-libfdk/locale/en-US.ini
@@ -0,0 +1,3 @@
+LibFDK="libfdk AAC Encoder"
+Bitrate="Bitrate"
+Afterburner="Enable AAC Afterburner"
diff --git a/build/data/obs-plugins/obs-outputs/locale/en-US.ini b/build/data/obs-plugins/obs-outputs/locale/en-US.ini
new file mode 100644
index 000000000..1a3a7fe7f
--- /dev/null
+++ b/build/data/obs-plugins/obs-outputs/locale/en-US.ini
@@ -0,0 +1,4 @@
+RTMPStream="RTMP Stream"
+RTMPStream.DropThreshold="Drop Threshold (milliseconds)"
+FLVOutput="FLV File Output"
+FLVOutput.FilePath="File Path"
diff --git a/build/data/obs-plugins/obs-x264/locale/en-US.ini b/build/data/obs-plugins/obs-x264/locale/en-US.ini
new file mode 100644
index 000000000..941aebe85
--- /dev/null
+++ b/build/data/obs-plugins/obs-x264/locale/en-US.ini
@@ -0,0 +1,7 @@
+Bitrate="Bitrate"
+BufferSize="Buffer Size"
+KeyframeIntervalSec="Keyframe Interval (seconds, 0=auto)"
+CPUPreset="CPU Usage Preset (encoder speed)"
+Profile="Profile"
+Tune="Tune"
+EncoderOptions="x264 Encoder Options (separated by space)"
diff --git a/build/data/obs-plugins/rtmp-services/locale/en-US.ini b/build/data/obs-plugins/rtmp-services/locale/en-US.ini
new file mode 100644
index 000000000..22c18bb52
--- /dev/null
+++ b/build/data/obs-plugins/rtmp-services/locale/en-US.ini
@@ -0,0 +1,5 @@
+StreamingServices="Streaming Services"
+CustomStreamingServer="Custom Streaming Server"
+Service="Service"
+Server="Server"
+StreamKey="Stream key"
diff --git a/build/data/obs-plugins/win-capture/locale/en-US.ini b/build/data/obs-plugins/win-capture/locale/en-US.ini
new file mode 100644
index 000000000..112e15969
--- /dev/null
+++ b/build/data/obs-plugins/win-capture/locale/en-US.ini
@@ -0,0 +1,9 @@
+MonitorCapture="Monitor Capture"
+WindowCapture="Window Capture"
+WindowCapture.Window="Window"
+WindowCapture.Priority="Window Match Priority"
+WindowCapture.Priority.Title="Window Title"
+WindowCapture.Priority.Class="Window Class"
+WindowCapture.Priority.Exe="Executable Name"
+CaptureCursor="Capture Cursor"
+Compatibility="Multi-adapter Compatibility"
diff --git a/build/data/obs-plugins/win-dshow/locale/en-US.ini b/build/data/obs-plugins/win-dshow/locale/en-US.ini
new file mode 100644
index 000000000..92a0b5dca
--- /dev/null
+++ b/build/data/obs-plugins/win-dshow/locale/en-US.ini
@@ -0,0 +1,13 @@
+VideoCaptureDevice="Video Capture Device"
+Device="Device"
+ConfigureVideo="Configure Video"
+ConfigureCrossbar="Configure Crossbar"
+ResFPSType="Resolution/FPS Type"
+ResFPSType.Custom="Custom"
+ResFPSType.DevPreferred="Device Preferred"
+FPS.Matching="Match Output FPS"
+FPS.Highest="Highest FPS"
+Resolution="Resolution"
+VideoFormat="Video Format"
+VideoFormat.Any="Any"
+VideoFormat.Unknown="Unknown (%1)"
diff --git a/build/data/obs-plugins/win-wasapi/locale/en-US.ini b/build/data/obs-plugins/win-wasapi/locale/en-US.ini
new file mode 100644
index 000000000..fe4453cc9
--- /dev/null
+++ b/build/data/obs-plugins/win-wasapi/locale/en-US.ini
@@ -0,0 +1,5 @@
+AudioInput="Audio Input Capture"
+AudioOutput="Audio Output Capture"
+Device="Device"
+Default="Default"
+UseDeviceTiming="Use Device Timestamps"
diff --git a/libobs/obs-module.c b/libobs/obs-module.c
index 25248668b..ae399af34 100644
--- a/libobs/obs-module.c
+++ b/libobs/obs-module.c
@@ -101,6 +101,54 @@ void free_module(struct obs_module *mod)
bfree(mod->name);
}
+lookup_t obs_module_load_locale(const char *module, const char *default_locale,
+ const char *locale)
+{
+ struct dstr str = {0};
+ lookup_t lookup = NULL;
+
+ if (!module || !default_locale || !locale) {
+ blog(LOG_WARNING, "obs_module_load_locale: Invalid parameters");
+ return NULL;
+ }
+
+ dstr_copy(&str, module);
+ dstr_cat(&str, "/locale/");
+ dstr_cat(&str, default_locale);
+ dstr_cat(&str, ".ini");
+
+ char *file = obs_find_plugin_file(str.array);
+ if (file)
+ lookup = text_lookup_create(file);
+
+ bfree(file);
+
+ if (!lookup) {
+ blog(LOG_WARNING, "Failed to load '%s' text for module: '%s'",
+ default_locale, module);
+ goto cleanup;
+ }
+
+ if (astrcmpi(locale, default_locale) == 0)
+ goto cleanup;
+
+ dstr_copy(&str, module);
+ dstr_cat(&str, "/locale/");
+ dstr_cat(&str, locale);
+ dstr_cat(&str, ".ini");
+
+ file = obs_find_plugin_file(str.array);
+
+ if (!text_lookup_add(lookup, file))
+ blog(LOG_WARNING, "Failed to load '%s' text for module: '%s'",
+ locale, module);
+
+ bfree(file);
+cleanup:
+ dstr_free(&str);
+ return lookup;
+}
+
#define REGISTER_OBS_DEF(size_var, structure, dest, info) \
do { \
struct structure data = {0}; \
diff --git a/libobs/obs-module.h b/libobs/obs-module.h
index 9fc899ae2..b2be6a887 100644
--- a/libobs/obs-module.h
+++ b/libobs/obs-module.h
@@ -53,6 +53,32 @@ MODULE_EXPORT void obs_module_unload(void);
/** Called to set the current locale data for the module. */
MODULE_EXPORT void obs_module_set_locale(const char *locale);
+/**
+ * Optional: Use this macro in a module to use default locale handling. Use
+ * the OBS_MODULE_FREE_DEFAULT_LOCALE macro in obs_module_unload to free the
+ * locale data when the module unloads.
+ */
+#define OBS_MODULE_USE_DEFAULT_LOCALE(module_name, default_locale) \
+ lookup_t obs_module_lookup = NULL; \
+ const char *obs_module_text(const char *val) \
+ { \
+ const char *out = val; \
+ text_lookup_getstr(obs_module_lookup, val, &out); \
+ return out; \
+ } \
+ void obs_module_set_locale(const char *locale) \
+ { \
+ if (obs_module_lookup) text_lookup_destroy(obs_module_lookup); \
+ obs_module_lookup = obs_module_load_locale(module_name, \
+ default_locale, locale); \
+ }
+
+#define OBS_MODULE_FREE_DEFAULT_LOCALE() \
+ text_lookup_destroy(obs_module_lookup)
+
+/** Helper function for looking up locale if default locale handler was used */
+extern const char *obs_module_text(const char *lookup_string);
+
/**
* Optional: Declares the author(s) of the module
*
diff --git a/libobs/obs.h b/libobs/obs.h
index e37957c3a..ca43b1c07 100644
--- a/libobs/obs.h
+++ b/libobs/obs.h
@@ -19,6 +19,7 @@
#include "util/c99defs.h"
#include "util/bmem.h"
+#include "util/text-lookup.h"
#include "graphics/graphics.h"
#include "graphics/vec2.h"
#include "graphics/vec3.h"
@@ -250,6 +251,10 @@ EXPORT bool obs_get_audio_info(struct audio_output_info *ai);
*/
EXPORT int obs_load_module(const char *path);
+/** Helper function for using default module locale */
+EXPORT lookup_t obs_module_load_locale(const char *module,
+ const char *default_locale, const char *locale);
+
/**
* Enumerates all available inputs source types.
*
diff --git a/plugins/image-source/CMakeLists.txt b/plugins/image-source/CMakeLists.txt
index 37ec6e1c9..30b021da7 100644
--- a/plugins/image-source/CMakeLists.txt
+++ b/plugins/image-source/CMakeLists.txt
@@ -9,3 +9,4 @@ target_link_libraries(image-source
libobs)
install_obs_plugin(image-source)
+install_obs_plugin_data(image-source ../../build/data/obs-plugins/image-source)
diff --git a/plugins/image-source/image-source.c b/plugins/image-source/image-source.c
index cd04da227..ff165b631 100644
--- a/plugins/image-source/image-source.c
+++ b/plugins/image-source/image-source.c
@@ -14,8 +14,7 @@ struct image_source {
static const char *image_source_get_name(void)
{
- /* TODO: locale */
- return "Image";
+ return obs_module_text("Image");
}
static void image_source_update(void *data, obs_data_t settings)
@@ -99,9 +98,9 @@ static obs_properties_t image_source_properties(void)
{
obs_properties_t props = obs_properties_create();
- /* TODO: locale */
- obs_properties_add_path(props, "file", "Image file", OBS_PATH_FILE,
- image_filter, NULL);
+ obs_properties_add_path(props,
+ "file", obs_module_text("File"),
+ OBS_PATH_FILE, image_filter, NULL);
return props;
}
@@ -121,6 +120,7 @@ static struct obs_source_info image_source_info = {
};
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("image-source", "en-US")
bool obs_module_load(uint32_t libobs_version)
{
@@ -129,3 +129,8 @@ bool obs_module_load(uint32_t libobs_version)
UNUSED_PARAMETER(libobs_version);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/linux-pulseaudio/CMakeLists.txt b/plugins/linux-pulseaudio/CMakeLists.txt
index 0cfbd27ff..06ce177b2 100644
--- a/plugins/linux-pulseaudio/CMakeLists.txt
+++ b/plugins/linux-pulseaudio/CMakeLists.txt
@@ -23,3 +23,4 @@ target_link_libraries(linux-pulseaudio
)
install_obs_plugin(linux-pulseaudio)
+install_obs_plugin_data(linux-pulseaudio ../../build/data/obs-plugins/linux-pulseaudio)
diff --git a/plugins/linux-pulseaudio/linux-pulseaudio.c b/plugins/linux-pulseaudio/linux-pulseaudio.c
index 1993dddce..69914fb7b 100644
--- a/plugins/linux-pulseaudio/linux-pulseaudio.c
+++ b/plugins/linux-pulseaudio/linux-pulseaudio.c
@@ -17,6 +17,7 @@ along with this program. If not, see .
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("linux-pulseaudio", "en-US")
extern struct obs_source_info pulse_input_capture;
extern struct obs_source_info pulse_output_capture;
@@ -28,3 +29,8 @@ bool obs_module_load(uint32_t obs_version)
obs_register_source(&pulse_output_capture);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/linux-pulseaudio/pulse-input.c b/plugins/linux-pulseaudio/pulse-input.c
index 659b24110..f96fd3d21 100644
--- a/plugins/linux-pulseaudio/pulse-input.c
+++ b/plugins/linux-pulseaudio/pulse-input.c
@@ -17,7 +17,7 @@ along with this program. If not, see .
#include
#include
-#include
+#include
#include "pulse-wrapper.h"
@@ -285,7 +285,8 @@ static obs_properties_t pulse_properties(bool input)
{
obs_properties_t props = obs_properties_create();
obs_property_t devices = obs_properties_add_list(props, "device_id",
- "Device", OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
+ obs_module_text("Device"), OBS_COMBO_TYPE_LIST,
+ OBS_COMBO_FORMAT_STRING);
pulse_init();
pa_source_info_cb_t cb = (input) ? pulse_input_info : pulse_output_info;
@@ -368,14 +369,12 @@ static void pulse_output_defaults(obs_data_t settings)
*/
static const char *pulse_input_getname(void)
{
- /* TODO: locale */
- return "Pulse Audio Input Capture";
+ return obs_module_text("PulseInput");
}
static const char *pulse_output_getname(void)
{
- /* TODO: locale */
- return "Pulse Audio Output Capture";
+ return obs_module_text("PulseOutput");
}
/**
diff --git a/plugins/linux-v4l2/CMakeLists.txt b/plugins/linux-v4l2/CMakeLists.txt
index 18cf924cb..124959c17 100644
--- a/plugins/linux-v4l2/CMakeLists.txt
+++ b/plugins/linux-v4l2/CMakeLists.txt
@@ -13,3 +13,4 @@ target_link_libraries(linux-v4l2
)
install_obs_plugin(linux-v4l2)
+install_obs_plugin_data(linux-v4l2 ../../build/data/obs-plugins/linux-v4l2)
diff --git a/plugins/linux-v4l2/linux-v4l2.c b/plugins/linux-v4l2/linux-v4l2.c
index 77b04817d..e81ee70f4 100644
--- a/plugins/linux-v4l2/linux-v4l2.c
+++ b/plugins/linux-v4l2/linux-v4l2.c
@@ -17,6 +17,7 @@ along with this program. If not, see .
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("linux-v4l2", "en-US")
extern struct obs_source_info v4l2_input;
@@ -26,3 +27,8 @@ bool obs_module_load(uint32_t obs_version)
obs_register_source(&v4l2_input);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/linux-v4l2/v4l2-input.c b/plugins/linux-v4l2/v4l2-input.c
index c54b4dd12..2479922c5 100644
--- a/plugins/linux-v4l2/v4l2-input.c
+++ b/plugins/linux-v4l2/v4l2-input.c
@@ -32,7 +32,7 @@ along with this program. If not, see .
#include
#include
#include
-#include
+#include
#define V4L2_DATA(voidptr) struct v4l2_data *data = voidptr;
@@ -268,8 +268,7 @@ exit:
static const char* v4l2_getname(void)
{
- /* TODO: locale */
- return "V4L2 Capture Input";
+ return obs_module_text("V4L2Input");
}
static void v4l2_defaults(obs_data_t settings)
@@ -465,16 +464,23 @@ static obs_properties_t v4l2_properties(void)
{
/* TODO: locale */
obs_properties_t props = obs_properties_create();
- obs_property_t device_list = obs_properties_add_list(props, "device_id",
- "Device", OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
+
+ obs_property_t device_list = obs_properties_add_list(props,
+ "device_id", obs_module_text("Device"),
+ OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
+
obs_property_t format_list = obs_properties_add_list(props,
- "pixelformat", "Image Format", OBS_COMBO_TYPE_LIST,
- OBS_COMBO_FORMAT_INT);
- obs_property_t resolution_list = obs_properties_add_list(props,
- "resolution", "Resolution", OBS_COMBO_TYPE_LIST,
- OBS_COMBO_FORMAT_INT);
- obs_properties_add_list(props, "framerate", "Frame Rate",
+ "pixelformat", obs_module_text("VideoFormat"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
+
+ obs_property_t resolution_list = obs_properties_add_list(props,
+ "resolution", obs_module_text("Resolution"),
+ OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
+
+ obs_properties_add_list(props,
+ "framerate", obs_module_text("FrameRate"),
+ OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
+
v4l2_device_list(device_list, NULL);
obs_property_set_modified_callback(device_list, device_selected);
obs_property_set_modified_callback(format_list, format_selected);
diff --git a/plugins/linux-xcomposite/CMakeLists.txt b/plugins/linux-xcomposite/CMakeLists.txt
index 2eca7286d..d97bb3b4e 100644
--- a/plugins/linux-xcomposite/CMakeLists.txt
+++ b/plugins/linux-xcomposite/CMakeLists.txt
@@ -26,3 +26,4 @@ target_link_libraries(linux-xcomposite
${X11_Xcomposite_LIB})
install_obs_plugin(linux-xcomposite)
+install_obs_plugin_data(linux-xcomposite ../../build/data/obs-plugins/linux-xcomposite)
diff --git a/plugins/linux-xcomposite/plugin-main.cpp b/plugins/linux-xcomposite/plugin-main.cpp
index b6f21aed5..19cfcf206 100644
--- a/plugins/linux-xcomposite/plugin-main.cpp
+++ b/plugins/linux-xcomposite/plugin-main.cpp
@@ -54,11 +54,11 @@ void xcompcap_update(void *data, obs_data_t settings)
}
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("linux-xcomposite", "en-US")
static const char* xcompcap_getname(void)
{
- /* TODO: locale */
- return "Xcomposite capture";
+ return obs_module_text("XCCapture");
}
bool obs_module_load(uint32_t libobs_version)
@@ -96,5 +96,7 @@ void obs_module_unload()
{
XCompcapMain::deinit();
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+
blog(LOG_INFO, "Xcomposite capture plugin unloaded");
}
diff --git a/plugins/linux-xcomposite/xcompcap-main.cpp b/plugins/linux-xcomposite/xcompcap-main.cpp
index 1ad665672..a49d27b15 100644
--- a/plugins/linux-xcomposite/xcompcap-main.cpp
+++ b/plugins/linux-xcomposite/xcompcap-main.cpp
@@ -51,8 +51,8 @@ obs_properties_t XCompcapMain::properties()
obs_properties_t props = obs_properties_create();
obs_property_t wins = obs_properties_add_list(props, "capture_window",
- "Captured Window", OBS_COMBO_TYPE_LIST,
- OBS_COMBO_FORMAT_STRING);
+ obs_module_text("Window"),
+ OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
for (Window win: XCompcap::getTopLevelWindows()) {
std::string wname = XCompcap::getWindowName(win);
@@ -66,18 +66,18 @@ obs_properties_t XCompcapMain::properties()
desc.c_str());
}
- obs_properties_add_int(props, "cut_top", "Cut top pixels",
+ obs_properties_add_int(props, "cut_top", obs_module_text("CropTop"),
0, 4096, 1);
- obs_properties_add_int(props, "cut_left", "Cut left pixels",
+ obs_properties_add_int(props, "cut_left", obs_module_text("CropLeft"),
0, 4096, 1);
- obs_properties_add_int(props, "cut_right", "Cut right pixels",
+ obs_properties_add_int(props, "cut_right", obs_module_text("CropRight"),
0, 4096, 1);
- obs_properties_add_int(props, "cut_bot", "Cut bottom pixels",
+ obs_properties_add_int(props, "cut_bot", obs_module_text("CropBottom"),
0, 4096, 1);
- obs_properties_add_bool(props, "swap_redblue", "Swap red and blue");
- obs_properties_add_bool(props, "lock_x", "Lock X server when "
- "capturing");
+ obs_properties_add_bool(props, "swap_redblue",
+ obs_module_text("SwapRedBlue"));
+ obs_properties_add_bool(props, "lock_x", obs_module_text("LockX"));
return props;
}
diff --git a/plugins/linux-xshm/CMakeLists.txt b/plugins/linux-xshm/CMakeLists.txt
index 270e0541a..0f71f65b5 100644
--- a/plugins/linux-xshm/CMakeLists.txt
+++ b/plugins/linux-xshm/CMakeLists.txt
@@ -28,3 +28,4 @@ target_link_libraries(linux-xshm
)
install_obs_plugin(linux-xshm)
+install_obs_plugin_data(linux-xshm ../../build/data/obs-plugins/linux-xshm)
diff --git a/plugins/linux-xshm/linux-xshm.c b/plugins/linux-xshm/linux-xshm.c
index 41aebec61..7981e4d8e 100644
--- a/plugins/linux-xshm/linux-xshm.c
+++ b/plugins/linux-xshm/linux-xshm.c
@@ -17,6 +17,7 @@ along with this program. If not, see .
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("linux-xshm", "en-US")
extern struct obs_source_info xshm_input;
@@ -26,3 +27,8 @@ bool obs_module_load(uint32_t obs_version)
obs_register_source(&xshm_input);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/linux-xshm/xshm-input.c b/plugins/linux-xshm/xshm-input.c
index 9808f90ab..d5e4b390c 100644
--- a/plugins/linux-xshm/xshm-input.c
+++ b/plugins/linux-xshm/xshm-input.c
@@ -21,7 +21,7 @@ along with this program. If not, see .
#include
#include
-#include
+#include
#include "xcursor.h"
#include "xhelpers.h"
@@ -110,8 +110,7 @@ static int_fast32_t xshm_update_geometry(struct xshm_data *data,
*/
static const char* xshm_getname(void)
{
- /* TODO: locale */
- return "X11 Shared Memory Screen Input";
+ return obs_module_text("X11SharedMemoryScreenInput");
}
/**
@@ -156,7 +155,6 @@ static void xshm_defaults(obs_data_t defaults)
*/
static obs_properties_t xshm_properties(void)
{
- /* TODO: locale */
obs_properties_t props = obs_properties_create();
int_fast32_t screen_max;
@@ -167,8 +165,10 @@ static obs_properties_t xshm_properties(void)
screen_max = (screen_max) ? screen_max - 1 : 0;
XCloseDisplay(dpy);
- obs_properties_add_int(props, "screen", "Screen", 0, screen_max, 1);
- obs_properties_add_bool(props, "show_cursor", "Capture Cursor");
+ obs_properties_add_int(props, "screen",
+ obs_module_text("Screen"), 0, screen_max, 1);
+ obs_properties_add_bool(props, "show_cursor",
+ obs_module_text("CaptureCursor"));
return props;
}
diff --git a/plugins/mac-avcapture/CMakeLists.txt b/plugins/mac-avcapture/CMakeLists.txt
index 18f7c38f7..a1b509443 100644
--- a/plugins/mac-avcapture/CMakeLists.txt
+++ b/plugins/mac-avcapture/CMakeLists.txt
@@ -38,4 +38,4 @@ target_link_libraries(mac-avcapture
${COCOA})
install_obs_plugin(mac-avcapture)
-
+install_obs_plugin_data(mac-avcapture ../../build/data/obs-plugins/mac-avcapture)
diff --git a/plugins/mac-avcapture/av-capture.m b/plugins/mac-avcapture/av-capture.m
index 9e753eb77..c285867c2 100644
--- a/plugins/mac-avcapture/av-capture.m
+++ b/plugins/mac-avcapture/av-capture.m
@@ -5,11 +5,16 @@
#include
-#include
+#include
#include
#import "AVCaptureInputPort+PreMavericksCompat.h"
+#define TEXT_AVCAPTURE obs_module_text("AVCapture")
+#define TEXT_DEVICE obs_module_text("Device")
+#define TEXT_USE_PRESET obs_module_text("UsePreset")
+#define TEXT_PRESET obs_module_text("Preset")
+
#define MILLI_TIMESCALE 1000
#define MICRO_TIMESCALE (MILLI_TIMESCALE * 1000)
#define NANO_TIMESCALE (MICRO_TIMESCALE * 1000)
@@ -241,8 +246,7 @@ static inline bool update_frame(struct av_capture *capture,
static const char *av_capture_getname(void)
{
- /* TODO: locale */
- return "Video Capture Device";
+ return TEXT_AVCAPTURE;
}
static void remove_device(struct av_capture *capture)
@@ -593,7 +597,6 @@ static NSString *preset_names(NSString *preset)
static void av_capture_defaults(obs_data_t settings)
{
- //TODO: localize
obs_data_set_default_string(settings, "device_name", "none");
obs_data_set_default_bool(settings, "use_preset", true);
obs_data_set_default_string(settings, "preset",
@@ -759,9 +762,8 @@ static obs_properties_t av_capture_properties(void)
{
obs_properties_t props = obs_properties_create();
- /* TODO: locale */
obs_property_t dev_list = obs_properties_add_list(props, "device",
- "Device", OBS_COMBO_TYPE_LIST,
+ TEXT_DEVICE, OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_STRING);
for (AVCaptureDevice *dev in [AVCaptureDevice
devicesWithMediaType:AVMediaTypeVideo]) {
@@ -774,12 +776,13 @@ static obs_properties_t av_capture_properties(void)
properties_device_changed);
obs_property_t use_preset = obs_properties_add_bool(props,
- "use_preset", "Use preset");
+ "use_preset", TEXT_USE_PRESET);
// TODO: implement manual configuration
obs_property_set_enabled(use_preset, false);
obs_property_t preset_list = obs_properties_add_list(props, "preset",
- "Preset", OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
+ TEXT_PRESET, OBS_COMBO_TYPE_LIST,
+ OBS_COMBO_FORMAT_STRING);
for (NSString *preset in presets())
obs_property_list_add_string(preset_list,
preset_names(preset).UTF8String,
diff --git a/plugins/mac-avcapture/plugin-main.c b/plugins/mac-avcapture/plugin-main.c
index 5bc458a57..e19c00dab 100644
--- a/plugins/mac-avcapture/plugin-main.c
+++ b/plugins/mac-avcapture/plugin-main.c
@@ -1,6 +1,7 @@
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("mac-avcapture", "en-US")
extern struct obs_source_info av_capture_info;
@@ -12,3 +13,8 @@ bool obs_module_load(uint32_t libobs_version)
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/mac-capture/mac-audio.c b/plugins/mac-capture/mac-audio.c
index 22b560658..eb2392213 100644
--- a/plugins/mac-capture/mac-audio.c
+++ b/plugins/mac-capture/mac-audio.c
@@ -4,7 +4,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -26,6 +26,11 @@
#define set_property AudioUnitSetProperty
#define get_property AudioUnitGetProperty
+#define TEXT_AUDIO_INPUT obs_module_text("CoreAudio.InputCapture");
+#define TEXT_AUDIO_OUTPUT obs_module_text("CoreAudio.OutputCapture");
+#define TEXT_DEVICE obs_module_text("CoreAudio.Device")
+#define TEXT_DEVICE_DEFAULT obs_module_text("CoreAudio.Device.Default")
+
struct coreaudio_data {
char *device_name;
char *device_uid;
@@ -630,14 +635,12 @@ static void coreaudio_uninit(struct coreaudio_data *ca)
static const char *coreaudio_input_getname(void)
{
- /* TODO: Locale */
- return "CoreAudio Input Capture";
+ return TEXT_AUDIO_INPUT;
}
static const char *coreaudio_output_getname(void)
{
- /* TODO: Locale */
- return "CoreAudio Output Capture";
+ return TEXT_AUDIO_OUTPUT;
}
static void coreaudio_destroy(void *data)
@@ -710,15 +713,14 @@ static obs_properties_t coreaudio_properties(bool input)
memset(&devices, 0, sizeof(struct device_list));
- /* TODO: translate */
- property = obs_properties_add_list(props, "device_id", "Device",
+ property = obs_properties_add_list(props, "device_id", TEXT_DEVICE,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
coreaudio_enum_devices(&devices, input);
- /* TODO: translate */
if (devices.items.num)
- obs_property_list_add_string(property, "Default", "default");
+ obs_property_list_add_string(property, TEXT_DEVICE_DEFAULT,
+ "default");
for (size_t i = 0; i < devices.items.num; i++) {
struct device_item *item = devices.items.array+i;
diff --git a/plugins/mac-capture/mac-display-capture.m b/plugins/mac-capture/mac-display-capture.m
index 295940be7..e05ff7e78 100644
--- a/plugins/mac-capture/mac-display-capture.m
+++ b/plugins/mac-capture/mac-display-capture.m
@@ -1,5 +1,5 @@
#include
-#include
+#include
#include
#include
@@ -260,7 +260,7 @@ static void display_capture_video_render(void *data, effect_t effect)
static const char *display_capture_getname(void)
{
- return "Display Capture";
+ return obs_module_text("DisplayCapture");
}
static uint32_t display_capture_getwidth(void *data)
@@ -304,7 +304,7 @@ static obs_properties_t display_capture_properties(void)
obs_properties_t props = obs_properties_create();
obs_property_t list = obs_properties_add_list(props,
- "display", "Display",
+ "display", obs_module_text("DisplayCapture.Display"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
for (unsigned i = 0; i < [NSScreen screens].count; i++) {
@@ -313,7 +313,8 @@ static obs_properties_t display_capture_properties(void)
obs_property_list_add_int(list, buf, i);
}
- obs_properties_add_bool(props, "show_cursor", "Show Cursor");
+ obs_properties_add_bool(props, "show_cursor",
+ obs_module_text("DisplayCapture.ShowCursor"));
return props;
}
diff --git a/plugins/mac-capture/plugin-main.c b/plugins/mac-capture/plugin-main.c
index 79422cd50..ff4ade1d6 100644
--- a/plugins/mac-capture/plugin-main.c
+++ b/plugins/mac-capture/plugin-main.c
@@ -1,6 +1,7 @@
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("mac-capture", "en-US")
extern struct obs_source_info coreaudio_input_capture_info;
extern struct obs_source_info coreaudio_output_capture_info;
@@ -15,3 +16,8 @@ bool obs_module_load(uint32_t libobs_version)
UNUSED_PARAMETER(libobs_version);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/obs-ffmpeg/CMakeLists.txt b/plugins/obs-ffmpeg/CMakeLists.txt
index 275c54965..5034a3270 100644
--- a/plugins/obs-ffmpeg/CMakeLists.txt
+++ b/plugins/obs-ffmpeg/CMakeLists.txt
@@ -46,4 +46,4 @@ target_link_libraries(obs-ffmpeg
${LIBSWRESAMPLE_LIBRARIES})
install_obs_plugin(obs-ffmpeg)
-
+install_obs_plugin_data(obs-ffmpeg ../../build/data/obs-plugins/obs-ffmpeg)
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-aac.c b/plugins/obs-ffmpeg/obs-ffmpeg-aac.c
index 3457ed70c..1114a2b19 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-aac.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-aac.c
@@ -18,7 +18,7 @@
#include
#include
#include
-#include
+#include
#include
@@ -46,8 +46,7 @@ struct aac_encoder {
static const char *aac_getname(void)
{
- /* TODO: locale */
- return "FFmpeg Default AAC Encoder";
+ return obs_module_text("FFmpegAAC");
}
static void aac_warn(const char *func, const char *format, ...)
@@ -242,8 +241,8 @@ static obs_properties_t aac_properties(void)
{
obs_properties_t props = obs_properties_create();
- /* TODO: locale */
- obs_properties_add_int(props, "bitrate", "Bitrate", 32, 320, 32);
+ obs_properties_add_int(props, "bitrate",
+ obs_module_text("Bitrate"), 32, 320, 32);
return props;
}
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-output.c b/plugins/obs-ffmpeg/obs-ffmpeg-output.c
index e6cf94f0a..a70b43868 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-output.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-output.c
@@ -15,7 +15,7 @@
along with this program. If not, see .
******************************************************************************/
-#include
+#include
#include
#include
#include
@@ -398,8 +398,7 @@ fail:
static const char *ffmpeg_output_getname(void)
{
- /* TODO: locale */
- return "FFmpeg file output";
+ return obs_module_text("FFmpegOutput");
}
static void ffmpeg_log_callback(void *param, int level, const char *format,
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c
index 7e6addc0f..3b0bd8258 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg.c
@@ -1,6 +1,7 @@
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("obs-ffmpeg", "en-US")
extern struct obs_output_info ffmpeg_output;
extern struct obs_encoder_info aac_encoder_info;
@@ -13,3 +14,8 @@ bool obs_module_load(uint32_t obs_version)
UNUSED_PARAMETER(obs_version);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/obs-libfdk/CMakeLists.txt b/plugins/obs-libfdk/CMakeLists.txt
index 4b63548e8..e0c9a5fbc 100644
--- a/plugins/obs-libfdk/CMakeLists.txt
+++ b/plugins/obs-libfdk/CMakeLists.txt
@@ -19,3 +19,4 @@ target_link_libraries(obs-libfdk
${LIBFDK_LIBRARIES})
install_obs_plugin(obs-libfdk)
+install_obs_plugin_data(obs-libfdk ../../build/data/obs-plugins/obs-libfdk)
diff --git a/plugins/obs-libfdk/obs-libfdk.c b/plugins/obs-libfdk/obs-libfdk.c
index 9a3d91354..aef905213 100644
--- a/plugins/obs-libfdk/obs-libfdk.c
+++ b/plugins/obs-libfdk/obs-libfdk.c
@@ -61,16 +61,17 @@ typedef struct libfdk_encoder {
static const char *libfdk_getname(void)
{
- /* TODO: locale */
- return "libfdk aac encoder";
+ return obs_module_text("LibFDK");
}
static obs_properties_t libfdk_properties(void)
{
obs_properties_t props = obs_properties_create();
- obs_properties_add_int(props, "bitrate", "Bitrate", 32, 256, 32);
- obs_properties_add_bool(props, "afterburner", "Enable AAC Afterburner");
+ obs_properties_add_int(props, "bitrate",
+ obs_module_text("Bitrate"), 32, 256, 32);
+ obs_properties_add_bool(props, "afterburner",
+ obs_module_text("Afterburner"));
return props;
}
@@ -309,3 +310,9 @@ bool obs_module_load(uint32_t libobs_ver)
}
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("obs-libfdk", "en-US")
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/obs-outputs/CMakeLists.txt b/plugins/obs-outputs/CMakeLists.txt
index 7d7e87542..2095154f8 100644
--- a/plugins/obs-outputs/CMakeLists.txt
+++ b/plugins/obs-outputs/CMakeLists.txt
@@ -55,4 +55,4 @@ target_link_libraries(obs-outputs
${obs-outputs_PLATFORM_DEPS})
install_obs_plugin(obs-outputs)
-
+install_obs_plugin_data(obs-outputs ../../build/data/obs-plugins/obs-outputs)
diff --git a/plugins/obs-outputs/flv-output.c b/plugins/obs-outputs/flv-output.c
index 7b84fa1ae..d3d85012d 100644
--- a/plugins/obs-outputs/flv-output.c
+++ b/plugins/obs-outputs/flv-output.c
@@ -16,7 +16,7 @@
******************************************************************************/
#include
-#include
+#include
#include
#include
#include
@@ -34,8 +34,7 @@ struct flv_output {
static const char *flv_output_getname(void)
{
- /* TODO: locale */
- return "FLV File Output";
+ return obs_module_text("FLVOutput");
}
static void flv_output_stop(void *data);
@@ -193,8 +192,9 @@ static obs_properties_t flv_output_properties(void)
{
obs_properties_t props = obs_properties_create();
- /* TODO: locale */
- obs_properties_add_text(props, "path", "File Path", OBS_TEXT_DEFAULT);
+ obs_properties_add_text(props, "path",
+ obs_module_text("FLVOutput.FilePath"),
+ OBS_TEXT_DEFAULT);
return props;
}
diff --git a/plugins/obs-outputs/obs-outputs.c b/plugins/obs-outputs/obs-outputs.c
index 7b2efb957..85afa866b 100644
--- a/plugins/obs-outputs/obs-outputs.c
+++ b/plugins/obs-outputs/obs-outputs.c
@@ -6,6 +6,7 @@
#endif
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("obs-outputs", "en-US")
extern struct obs_output_info rtmp_output_info;
extern struct obs_output_info flv_output_info;
@@ -24,9 +25,11 @@ bool obs_module_load(uint32_t libobs_ver)
return true;
}
-#ifdef _WIN32
void obs_module_unload(void)
{
+#ifdef _WIN32
WSACleanup();
-}
#endif
+
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c
index c21c263ea..e2c1faa9d 100644
--- a/plugins/obs-outputs/rtmp-stream.c
+++ b/plugins/obs-outputs/rtmp-stream.c
@@ -15,7 +15,7 @@
along with this program. If not, see .
******************************************************************************/
-#include
+#include
#include
#include
#include
@@ -71,8 +71,7 @@ struct rtmp_stream {
static const char *rtmp_stream_getname(void)
{
- /* TODO: locale stuff */
- return "RTMP Stream";
+ return obs_module_text("RTMPStream");
}
static void log_rtmp(int level, const char *format, va_list args)
@@ -570,9 +569,9 @@ static obs_properties_t rtmp_stream_properties(void)
{
obs_properties_t props = obs_properties_create();
- /* TODO: locale */
obs_properties_add_int(props, OPT_DROP_THRESHOLD,
- "Drop threshold (milliseconds)", 200, 10000, 100);
+ obs_module_text("RTMPStream.DropThreshold"),
+ 200, 10000, 100);
return props;
}
diff --git a/plugins/obs-x264/CMakeLists.txt b/plugins/obs-x264/CMakeLists.txt
index 93fd36808..57a8c0c70 100644
--- a/plugins/obs-x264/CMakeLists.txt
+++ b/plugins/obs-x264/CMakeLists.txt
@@ -15,4 +15,4 @@ target_link_libraries(obs-x264
${LIBX264_LIBRARIES})
install_obs_plugin(obs-x264)
-
+install_obs_plugin_data(obs-x264 ../../build/data/obs-plugins/obs-x264)
diff --git a/plugins/obs-x264/obs-x264-plugin-main.c b/plugins/obs-x264/obs-x264-plugin-main.c
index 4086afa32..d07cd3b33 100644
--- a/plugins/obs-x264/obs-x264-plugin-main.c
+++ b/plugins/obs-x264/obs-x264-plugin-main.c
@@ -1,6 +1,7 @@
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("obs-x264", "en-US")
extern struct obs_encoder_info obs_x264_encoder;
@@ -11,3 +12,8 @@ bool obs_module_load(uint32_t libobs_ver)
UNUSED_PARAMETER(libobs_ver);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/obs-x264/obs-x264.c b/plugins/obs-x264/obs-x264.c
index 25fca7644..f58bcf252 100644
--- a/plugins/obs-x264/obs-x264.c
+++ b/plugins/obs-x264/obs-x264.c
@@ -17,7 +17,7 @@
#include
#include
-#include
+#include
#include
struct obs_x264 {
@@ -40,7 +40,6 @@ struct obs_x264 {
static const char *obs_x264_getname(void)
{
- /* TODO locale lookup */
return "x264";
}
@@ -92,37 +91,39 @@ static inline void add_strings(obs_property_t list, const char *const *strings)
}
}
+#define TEXT_BITRATE obs_module_text("Bitrate")
+#define TEXT_BUF_SIZE obs_module_text("BufferSize")
+#define TEXT_KEYINT_SEC obs_module_text("KeyframeIntervalSec")
+#define TEXT_PRESET obs_module_text("CPUPreset")
+#define TEXT_PROFILE obs_module_text("Profile")
+#define TEXT_TUNE obs_module_text("Tune")
+#define TEXT_X264_OPTS obs_module_text("EncoderOptions")
+
static obs_properties_t obs_x264_props(void)
{
- /* TODO: locale */
-
obs_properties_t props = obs_properties_create();
obs_property_t list;
- obs_properties_add_int(props, "bitrate", "Bitrate", 50, 100000, 1);
- obs_properties_add_int(props, "buffer_size", "Buffer Size", 50, 100000,
+ obs_properties_add_int(props, "bitrate", TEXT_BITRATE, 50, 100000, 1);
+ obs_properties_add_int(props, "buffer_size", TEXT_BUF_SIZE, 50, 100000,
1);
- obs_properties_add_int(props,
- "keyint_sec", "Keyframe interval (seconds, 0=auto)",
- 0, 20, 1);
+ obs_properties_add_int(props, "keyint_sec", TEXT_KEYINT_SEC, 0, 20, 1);
- list = obs_properties_add_list(props,
- "preset", "CPU Usage Preset (encoder speed)",
+ list = obs_properties_add_list(props, "preset", TEXT_PRESET,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
add_strings(list, x264_preset_names);
- list = obs_properties_add_list(props, "profile", "Profile",
+ list = obs_properties_add_list(props, "profile", TEXT_PROFILE,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
obs_property_list_add_string(list, "baseline", "baseline");
obs_property_list_add_string(list, "main", "main");
obs_property_list_add_string(list, "high", "high");
- list = obs_properties_add_list(props, "tune", "Tune",
+ list = obs_properties_add_list(props, "tune", TEXT_TUNE,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
add_strings(list, x264_tune_names);
- obs_properties_add_text(props, "x264opts",
- "x264 encoder options (separated by space)",
+ obs_properties_add_text(props, "x264opts", TEXT_X264_OPTS,
OBS_TEXT_DEFAULT);
return props;
diff --git a/plugins/rtmp-services/rtmp-common.c b/plugins/rtmp-services/rtmp-common.c
index c96174604..315a53dd9 100644
--- a/plugins/rtmp-services/rtmp-common.c
+++ b/plugins/rtmp-services/rtmp-common.c
@@ -10,8 +10,7 @@ struct rtmp_common {
static const char *rtmp_common_getname(void)
{
- /* TODO: locale */
- return "Streaming Services";
+ return obs_module_text("StreamingServices");
}
static void rtmp_common_update(void *data, obs_data_t settings)
@@ -204,9 +203,8 @@ static obs_properties_t rtmp_common_properties(void)
obs_property_t list;
char *file;
- /* TODO: locale */
-
- list = obs_properties_add_list(ppts, "service", "Service",
+ list = obs_properties_add_list(ppts, "service",
+ obs_module_text("Service"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
file = obs_find_plugin_file("rtmp-services/services.json");
@@ -217,10 +215,11 @@ static obs_properties_t rtmp_common_properties(void)
bfree(file);
}
- obs_properties_add_list(ppts, "server", "Server",
+ obs_properties_add_list(ppts, "server", obs_module_text("Server"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
- obs_properties_add_text(ppts, "key", "Stream Key", OBS_TEXT_PASSWORD);
+ obs_properties_add_text(ppts, "key", obs_module_text("StreamKey"),
+ OBS_TEXT_PASSWORD);
return ppts;
}
diff --git a/plugins/rtmp-services/rtmp-custom.c b/plugins/rtmp-services/rtmp-custom.c
index 875b3243f..29091fc71 100644
--- a/plugins/rtmp-services/rtmp-custom.c
+++ b/plugins/rtmp-services/rtmp-custom.c
@@ -6,8 +6,7 @@ struct rtmp_custom {
static const char *rtmp_custom_name(void)
{
- /* TODO: locale */
- return "Custom Streaming Server";
+ return obs_module_text("CustomStreamingServer");
}
static void rtmp_custom_update(void *data, obs_data_t settings)
@@ -43,10 +42,10 @@ static obs_properties_t rtmp_custom_properties(void)
{
obs_properties_t ppts = obs_properties_create();
- /* TODO: locale */
-
obs_properties_add_text(ppts, "server", "URL", OBS_TEXT_DEFAULT);
- obs_properties_add_text(ppts, "key", "Stream Key", OBS_TEXT_PASSWORD);
+
+ obs_properties_add_text(ppts, "key", obs_module_text("StreamKey"),
+ OBS_TEXT_PASSWORD);
return ppts;
}
diff --git a/plugins/rtmp-services/rtmp-services-main.c b/plugins/rtmp-services/rtmp-services-main.c
index bc79bfba0..26a16cddc 100644
--- a/plugins/rtmp-services/rtmp-services-main.c
+++ b/plugins/rtmp-services/rtmp-services-main.c
@@ -1,5 +1,10 @@
+#include
+#include
#include
+OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("rtmp-services", "en-US")
+
extern struct obs_service_info rtmp_common_service;
extern struct obs_service_info rtmp_custom_service;
@@ -11,3 +16,8 @@ bool obs_module_load(uint32_t libobs_ver)
UNUSED_PARAMETER(libobs_ver);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/win-capture/dc-capture.h b/plugins/win-capture/dc-capture.h
index 44930bf58..213a74b90 100644
--- a/plugins/win-capture/dc-capture.h
+++ b/plugins/win-capture/dc-capture.h
@@ -3,7 +3,7 @@
#define WIN32_LEAN_AND_MEAN
#include
-#include
+#include
#define NUM_TEXTURES 2
diff --git a/plugins/win-capture/monitor-capture.c b/plugins/win-capture/monitor-capture.c
index 8f72e2ebf..a8e3aec15 100644
--- a/plugins/win-capture/monitor-capture.c
+++ b/plugins/win-capture/monitor-capture.c
@@ -83,8 +83,7 @@ static inline void update_settings(struct monitor_capture *capture,
static const char *monitor_capture_getname(void)
{
- /* TODO: locale */
- return "Monitor Capture";
+ return obs_module_text("MonitorCapture");
}
static void monitor_capture_destroy(void *data)
diff --git a/plugins/win-capture/plugin-main.c b/plugins/win-capture/plugin-main.c
index c02afc88e..189b40501 100644
--- a/plugins/win-capture/plugin-main.c
+++ b/plugins/win-capture/plugin-main.c
@@ -1,6 +1,7 @@
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("win-capture", "en-US")
extern struct obs_source_info monitor_capture_info;
extern struct obs_source_info window_capture_info;
@@ -13,3 +14,8 @@ bool obs_module_load(uint32_t libobs_ver)
UNUSED_PARAMETER(libobs_ver);
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/win-capture/window-capture.c b/plugins/win-capture/window-capture.c
index 02ecc69a4..a88407c4d 100644
--- a/plugins/win-capture/window-capture.c
+++ b/plugins/win-capture/window-capture.c
@@ -3,6 +3,15 @@
#include "dc-capture.h"
#include
+#define TEXT_WINDOW_CAPTURE obs_module_text("WindowCapture")
+#define TEXT_WINDOW obs_module_text("WindowCapture.Window")
+#define TEXT_MATCH_PRIORITY obs_module_text("WindowCapture.Priority")
+#define TEXT_MATCH_TITLE obs_module_text("WindowCapture.Priority.Title")
+#define TEXT_MATCH_CLASS obs_module_text("WindowCapture.Priority.Class")
+#define TEXT_MATCH_EXE obs_module_text("WindowCapture.Priority.Exe")
+#define TEXT_CAPTURE_CURSOR obs_module_text("CaptureCursor")
+#define TEXT_COMPATIBILITY obs_module_text("Compatibility")
+
enum window_priority {
WINDOW_PRIORITY_CLASS,
WINDOW_PRIORITY_TITLE,
@@ -296,8 +305,7 @@ static HWND find_window(struct window_capture *wc)
static const char *wc_getname(void)
{
- /* TODO: locale */
- return "Window capture";
+ return TEXT_WINDOW_CAPTURE;
}
static void *wc_create(obs_data_t settings, obs_source_t source)
@@ -366,21 +374,19 @@ static obs_properties_t wc_properties(void)
obs_properties_t ppts = obs_properties_create();
obs_property_t p;
- /* TODO: locale */
- p = obs_properties_add_list(ppts, "window", "Window",
+ p = obs_properties_add_list(ppts, "window", TEXT_WINDOW,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
fill_window_list(p);
- p = obs_properties_add_list(ppts, "priority", "Window Match Priority",
+ p = obs_properties_add_list(ppts, "priority", TEXT_MATCH_PRIORITY,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
- obs_property_list_add_int(p, "Window Title", WINDOW_PRIORITY_TITLE);
- obs_property_list_add_int(p, "Window Class", WINDOW_PRIORITY_CLASS);
- obs_property_list_add_int(p, "Executable", WINDOW_PRIORITY_EXE);
+ obs_property_list_add_int(p, TEXT_MATCH_TITLE, WINDOW_PRIORITY_TITLE);
+ obs_property_list_add_int(p, TEXT_MATCH_CLASS, WINDOW_PRIORITY_CLASS);
+ obs_property_list_add_int(p, TEXT_MATCH_EXE, WINDOW_PRIORITY_EXE);
- obs_properties_add_bool(ppts, "cursor", "Capture Cursor");
+ obs_properties_add_bool(ppts, "cursor", TEXT_CAPTURE_CURSOR);
- obs_properties_add_bool(ppts, "compatibility",
- "Laptop Compatibility Mode");
+ obs_properties_add_bool(ppts, "compatibility", TEXT_COMPATIBILITY);
return ppts;
}
diff --git a/plugins/win-dshow/CMakeLists.txt b/plugins/win-dshow/CMakeLists.txt
index 6bf17e7e7..1f25bb105 100644
--- a/plugins/win-dshow/CMakeLists.txt
+++ b/plugins/win-dshow/CMakeLists.txt
@@ -32,3 +32,4 @@ target_link_libraries(win-dshow
strmiids.lib)
install_obs_plugin(win-dshow)
+install_obs_plugin_data(win-dshow ../../build/data/obs-plugins/win-dshow)
diff --git a/plugins/win-dshow/win-dshow.cpp b/plugins/win-dshow/win-dshow.cpp
index befe313a8..12859dd1d 100644
--- a/plugins/win-dshow/win-dshow.cpp
+++ b/plugins/win-dshow/win-dshow.cpp
@@ -34,6 +34,19 @@ using namespace DShow;
#define LAST_VIDEO_DEV_ID "last_video_device_id"
#define LAST_RESOLUTION "last_resolution"
+#define TEXT_INPUT_NAME obs_module_text("VideoCaptureDevice")
+#define TEXT_DEVICE obs_module_text("Device")
+#define TEXT_CONFIG_VIDEO obs_module_text("ConfigureVideo")
+#define TEXT_CONFIG_XBAR obs_module_text("ConfigureCrossbar")
+#define TEXT_RES_FPS_TYPE obs_module_text("ResFPSType")
+#define TEXT_CUSTOM_RES obs_module_text("ResFPSType.Custom")
+#define TEXT_PREFERRED_RES obs_module_text("ResFPSType.DevPreferred")
+#define TEXT_FPS_MATCHING obs_module_text("FPS.Matching")
+#define TEXT_FPS_HIGHEST obs_module_text("FPS.Highest")
+#define TEXT_RESOLUTION obs_module_text("Resolution")
+#define TEXT_VIDEO_FORMAT obs_module_text("VideoFormat")
+#define TEXT_FORMAT_UNKNOWN obs_module_text("VideoFormat.Unknown")
+
enum ResType {
ResType_Preferred,
ResType_Custom
@@ -454,8 +467,7 @@ void DShowInput::Update(obs_data_t settings)
static const char *GetDShowInputName(void)
{
- /* TODO: locale */
- return "Video Capture Device";
+ return TEXT_INPUT_NAME;
}
static void *CreateDShowInput(obs_data_t settings, obs_source_t source)
@@ -630,7 +642,7 @@ struct VideoFormatName {
static const VideoFormatName videoFormatNames[] = {
/* autoselect format*/
- {VideoFormat::Any, "Any"},
+ {VideoFormat::Any, "VideoFormat.Any"},
/* raw formats */
{VideoFormat::ARGB, "ARGB"},
@@ -839,12 +851,12 @@ static DStr GetFPSName(long long interval)
DStr name;
if (interval == FPS_MATCHING) {
- dstr_cat(name, "Match OBS FPS");
+ dstr_cat(name, TEXT_FPS_MATCHING);
return name;
}
if (interval == FPS_HIGHEST) {
- dstr_cat(name, "Highest");
+ dstr_cat(name, TEXT_FPS_HIGHEST);
return name;
}
@@ -867,8 +879,8 @@ static void UpdateFPS(VideoDevice &device, VideoFormat format,
obs_property_list_clear(list);
- obs_property_list_add_int(list, "Match OBS FPS", FPS_MATCHING);
- obs_property_list_add_int(list, "Highest", FPS_HIGHEST);
+ obs_property_list_add_int(list, TEXT_FPS_MATCHING, FPS_MATCHING);
+ obs_property_list_add_int(list, TEXT_FPS_HIGHEST, FPS_HIGHEST);
bool interval_added = interval == FPS_HIGHEST ||
interval == FPS_MATCHING;
@@ -905,12 +917,13 @@ static DStr GetVideoFormatName(VideoFormat format)
DStr name;
for (const VideoFormatName &format_ : videoFormatNames) {
if (format_.format == format) {
- dstr_cat(name, format_.name);
+ dstr_cat(name, obs_module_text(format_.name));
return name;
}
}
- dstr_catf(name, "Unknown (%lld)", (long long)format);
+ dstr_cat(name, TEXT_FORMAT_UNKNOWN);
+ dstr_replace(name, "%1", std::to_string((long long)format).c_str());
return name;
}
@@ -942,7 +955,8 @@ static void UpdateVideoFormats(VideoDevice &device, VideoFormat format_,
if (format.format == format_)
format_added = true;
- size_t idx = obs_property_list_add_int(list, format.name,
+ size_t idx = obs_property_list_add_int(list,
+ obs_module_text(format.name),
(long long)format.format);
obs_property_list_item_disable(list, idx, !available);
}
@@ -1110,10 +1124,9 @@ static obs_properties_t GetDShowProperties(void)
obs_properties_set_param(ppts, data, PropertiesDataDestroy);
- /* TODO: locale */
obs_property_t p = obs_properties_add_list(ppts,
- VIDEO_DEVICE_ID, "Device",
- OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
+ VIDEO_DEVICE_ID, TEXT_DEVICE,
+ OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
obs_property_set_modified_callback(p, DeviceSelectionChanged);
@@ -1121,22 +1134,22 @@ static obs_properties_t GetDShowProperties(void)
for (const VideoDevice &device : data->devices)
AddDevice(p, device);
- obs_properties_add_button(ppts, "video_config", "Configure Video",
+ obs_properties_add_button(ppts, "video_config", TEXT_CONFIG_VIDEO,
VideoConfigClicked);
- obs_properties_add_button(ppts, "xbar_config", "Configure Crossbar",
+ obs_properties_add_button(ppts, "xbar_config", TEXT_CONFIG_XBAR,
CrossbarConfigClicked);
/* ------------------------------------- */
- p = obs_properties_add_list(ppts, RES_TYPE, "Resolution/FPS Type",
+ p = obs_properties_add_list(ppts, RES_TYPE, TEXT_RES_FPS_TYPE,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_set_modified_callback(p, ResTypeChanged);
- obs_property_list_add_int(p, "Device Preferred", ResType_Preferred);
- obs_property_list_add_int(p, "Custom", ResType_Custom);
+ obs_property_list_add_int(p, TEXT_PREFERRED_RES, ResType_Preferred);
+ obs_property_list_add_int(p, TEXT_CUSTOM_RES, ResType_Custom);
- p = obs_properties_add_list(ppts, RESOLUTION, "Resolution",
+ p = obs_properties_add_list(ppts, RESOLUTION, TEXT_RESOLUTION,
OBS_COMBO_TYPE_EDITABLE, OBS_COMBO_FORMAT_STRING);
obs_property_set_modified_callback(p, DeviceResolutionChanged);
@@ -1146,7 +1159,7 @@ static obs_properties_t GetDShowProperties(void)
obs_property_set_modified_callback(p, DeviceIntervalChanged);
- p = obs_properties_add_list(ppts, VIDEO_FORMAT, "Video Format",
+ p = obs_properties_add_list(ppts, VIDEO_FORMAT, TEXT_VIDEO_FORMAT,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_set_modified_callback(p, VideoFormatChanged);
@@ -1155,6 +1168,7 @@ static obs_properties_t GetDShowProperties(void)
}
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("win-dshow", "en-US")
void DShowModuleLogCallback(LogType type, const wchar_t *msg, void *param)
{
@@ -1198,3 +1212,8 @@ bool obs_module_load(uint32_t libobs_ver)
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/win-wasapi/CMakeLists.txt b/plugins/win-wasapi/CMakeLists.txt
index 6ab27bb96..83e04a7c6 100644
--- a/plugins/win-wasapi/CMakeLists.txt
+++ b/plugins/win-wasapi/CMakeLists.txt
@@ -15,3 +15,4 @@ target_link_libraries(win-wasapi
libobs)
install_obs_plugin(win-wasapi)
+install_obs_plugin_data(win-wasapi ../../build/data/obs-plugins/win-wasapi)
diff --git a/plugins/win-wasapi/plugin-main.cpp b/plugins/win-wasapi/plugin-main.cpp
index 5efad40b2..aa6e757cf 100644
--- a/plugins/win-wasapi/plugin-main.cpp
+++ b/plugins/win-wasapi/plugin-main.cpp
@@ -1,6 +1,7 @@
#include
OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("win-wasapi", "en-US")
void RegisterWASAPIInput();
void RegisterWASAPIOutput();
@@ -13,3 +14,8 @@ bool obs_module_load(uint32_t libobs_ver)
RegisterWASAPIOutput();
return true;
}
+
+void obs_module_unload(void)
+{
+ OBS_MODULE_FREE_DEFAULT_LOCALE();
+}
diff --git a/plugins/win-wasapi/win-wasapi.cpp b/plugins/win-wasapi/win-wasapi.cpp
index 43f7d7e4e..f75983977 100644
--- a/plugins/win-wasapi/win-wasapi.cpp
+++ b/plugins/win-wasapi/win-wasapi.cpp
@@ -1,6 +1,6 @@
#include "enum-wasapi.hpp"
-#include
+#include
#include
#include
#include
@@ -421,14 +421,12 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param)
static const char *GetWASAPIInputName(void)
{
- /* TODO: translate */
- return "Audio Input Capture (WASAPI)";
+ return obs_module_text("AudioInput");
}
static const char *GetWASAPIOutputName(void)
{
- /* TODO: translate */
- return "Audio Output Capture (WASAPI)";
+ return obs_module_text("AudioOutput");
}
static void GetWASAPIDefaults(obs_data_t settings)
@@ -476,13 +474,14 @@ static obs_properties_t GetWASAPIProperties(bool input)
/* TODO: translate */
obs_property_t device_prop = obs_properties_add_list(props,
- OPT_DEVICE_ID, "Device",
+ OPT_DEVICE_ID, obs_module_text("Device"),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
GetWASAPIAudioDevices(devices, input);
if (devices.size())
- obs_property_list_add_string(device_prop, "Default", "default");
+ obs_property_list_add_string(device_prop,
+ obs_module_text("Default"), "default");
for (size_t i = 0; i < devices.size(); i++) {
AudioDeviceInfo &device = devices[i];
@@ -492,7 +491,7 @@ static obs_properties_t GetWASAPIProperties(bool input)
obs_property_t prop;
prop = obs_properties_add_bool(props, OPT_USE_DEVICE_TIMING,
- "Use Device Timing");
+ obs_module_text("UseDeviceTiming"));
return props;
}