diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c index 01359244a..5b725fbb8 100644 --- a/spa/plugins/bluez5/bluez5-device.c +++ b/spa/plugins/bluez5/bluez5-device.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,11 @@ #define DEVICE_ID_SINK 1 #define DYNAMIC_NODE_ID_FLAG 0x1000 +static struct spa_i18n *_i18n; + +#define _(_str) spa_i18n_text(_i18n,(_str)) +#define N_(_str) (_str) + enum { DEVICE_PROFILE_OFF = 0, DEVICE_PROFILE_AG = 1, @@ -836,7 +842,7 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * switch (profile_index) { case DEVICE_PROFILE_OFF: name = "off"; - desc = "Off"; + desc = _("Off"); break; case DEVICE_PROFILE_AG: { @@ -846,7 +852,7 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * return NULL; } else { name = "audio-gateway"; - desc = "Audio Gateway (A2DP Source & HSP/HFP AG)"; + desc = _("Audio Gateway (A2DP Source & HSP/HFP AG)"); } break; } @@ -858,9 +864,9 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * if (!(profile & SPA_BT_PROFILE_A2DP_SINK)) { return NULL; } else if (profile == SPA_BT_PROFILE_A2DP_SINK) { - desc = "High Fidelity Playback (A2DP Sink%s%s)"; + desc = _("High Fidelity Playback (A2DP Sink%s%s)"); } else { - desc = "High Fidelity Duplex (A2DP Source/Sink%s%s)"; + desc = _("High Fidelity Duplex (A2DP Source/Sink%s%s)"); } name = spa_bt_profile_name(profile); n_sink++; @@ -888,7 +894,7 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * if (profile == 0) { return NULL; } else { - desc = "Headset Head Unit (HSP/HFP%s%s)"; + desc = _("Headset Head Unit (HSP/HFP%s%s)"); } name = spa_bt_profile_name(profile); n_source++; @@ -967,53 +973,53 @@ static struct spa_pod *build_route(struct impl *this, struct spa_pod_builder *b, switch (ff) { case SPA_BT_FORM_FACTOR_HEADSET: name_prefix = "headset"; - description = "Headset"; + description = _("Headset"); port_type = "headset"; break; case SPA_BT_FORM_FACTOR_HANDSFREE: name_prefix = "handsfree"; - description = "Handsfree"; + description = _("Handsfree"); port_type = "handsfree"; break; case SPA_BT_FORM_FACTOR_MICROPHONE: name_prefix = "microphone"; - description = "Microphone"; + description = _("Microphone"); port_type = "mic"; break; case SPA_BT_FORM_FACTOR_SPEAKER: name_prefix = "speaker"; - description = "Speaker"; + description = _("Speaker"); port_type = "speaker"; break; case SPA_BT_FORM_FACTOR_HEADPHONE: name_prefix = "headphone"; - description = "Headphone"; + description = _("Headphone"); port_type = "headphones"; break; case SPA_BT_FORM_FACTOR_PORTABLE: name_prefix = "portable"; - description = "Portable"; + description = _("Portable"); port_type = "portable"; break; case SPA_BT_FORM_FACTOR_CAR: name_prefix = "car"; - description = "Car"; + description = _("Car"); port_type = "car"; break; case SPA_BT_FORM_FACTOR_HIFI: name_prefix = "hifi"; - description = "HiFi"; + description = _("HiFi"); port_type = "hifi"; break; case SPA_BT_FORM_FACTOR_PHONE: name_prefix = "phone"; - description = "Phone"; + description = _("Phone"); port_type = "phone"; break; case SPA_BT_FORM_FACTOR_UNKNOWN: default: name_prefix = "bluetooth"; - description = "Bluetooth"; + description = _("Bluetooth"); port_type = "bluetooth"; break; } @@ -1683,6 +1689,7 @@ impl_init(const struct spa_handle_factory *factory, this = (struct impl *) handle; this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log); + _i18n = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_I18N); if (info && (str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_DEVICE))) sscanf(str, "pointer:%p", &this->bt_dev); diff --git a/src/daemon/pipewire.c b/src/daemon/pipewire.c index 426549540..61493521b 100644 --- a/src/daemon/pipewire.c +++ b/src/daemon/pipewire.c @@ -40,10 +40,10 @@ static void do_quit(void *data, int signal_number) static void show_help(const char *name, const char *config_name) { - fprintf(stdout, "%s [options]\n" + fprintf(stdout, _("%s [options]\n" " -h, --help Show this help\n" " --version Show version\n" - " -c, --config Load config (Default %s)\n", + " -c, --config Load config (Default %s)\n"), name, config_name); } diff --git a/src/examples/media-session/alsa-monitor.c b/src/examples/media-session/alsa-monitor.c index 72696b772..f49ee6ded 100644 --- a/src/examples/media-session/alsa-monitor.c +++ b/src/examples/media-session/alsa-monitor.c @@ -523,11 +523,11 @@ static int update_device_props(struct device *device) if ((s = pw_properties_get(p, PW_KEY_DEVICE_FORM_FACTOR))) if (strcmp(s, "internal") == 0) - d = "Built-in Audio"; + d = _("Built-in Audio"); if (!d) if ((s = pw_properties_get(p, PW_KEY_DEVICE_CLASS))) if (strcmp(s, "modem") == 0) - d = "Modem"; + d = _("Modem"); if (!d) d = pw_properties_get(p, PW_KEY_DEVICE_PRODUCT_NAME); @@ -536,7 +536,7 @@ static int update_device_props(struct device *device) if (!d) d = pw_properties_get(p, "alsa.card_name"); if (!d) - d = "Unknown device"; + d = _("Unknown device"); pw_properties_set(p, PW_KEY_DEVICE_DESCRIPTION, d); } diff --git a/src/tools/pw-cat.c b/src/tools/pw-cat.c index 29b51a044..7eb13da91 100644 --- a/src/tools/pw-cat.c +++ b/src/tools/pw-cat.c @@ -987,16 +987,15 @@ static void show_usage(const char *name, bool is_error) fp = is_error ? stderr : stdout; - fprintf(fp, "%s [options] \n", name); - - fprintf(fp, + fprintf(fp, + _("%s [options] \n" " -h, --help Show this help\n" " --version Show version\n" " -v, --verbose Enable verbose operations\n" - "\n"); + "\n"), name); fprintf(fp, - " -R, --remote Remote daemon name\n" + _(" -R, --remote Remote daemon name\n" " --media-type Set media type (default %s)\n" " --media-category Set media category (default %s)\n" " --media-role Set media role (default %s)\n" @@ -1007,14 +1006,14 @@ static void show_usage(const char *name, bool is_error) " or direct samples (256)\n" " the rate is the one of the source file\n" " --list-targets List available targets for --target\n" - "\n", + "\n"), DEFAULT_MEDIA_TYPE, DEFAULT_MEDIA_CATEGORY_PLAYBACK, DEFAULT_MEDIA_ROLE, DEFAULT_TARGET, DEFAULT_LATENCY_PLAY); fprintf(fp, - " --rate Sample rate (req. for rec) (default %u)\n" + _(" --rate Sample rate (req. for rec) (default %u)\n" " --channels Number of channels (req. for rec) (default %u)\n" " --channel-map Channel map\n" " one of: \"stereo\", \"surround-51\",... or\n" @@ -1022,7 +1021,7 @@ static void show_usage(const char *name, bool is_error) " --format Sample format %s (req. for rec) (default %s)\n" " --volume Stream volume 0-1.0 (default %.3f)\n" " -q --quality Resampler quality (0 - 15) (default %d)\n" - "\n", + "\n"), DEFAULT_RATE, DEFAULT_CHANNELS, STR_FMTS, DEFAULT_FORMAT, @@ -1030,11 +1029,11 @@ static void show_usage(const char *name, bool is_error) DEFAULT_QUALITY); if (!strcmp(name, "pw-cat")) { - fprintf(fp, - " -p, --playback Playback mode\n" + fputs( + _(" -p, --playback Playback mode\n" " -r, --record Recording mode\n" " -m, --midi Midi mode\n" - "\n"); + "\n"), fp); } } diff --git a/src/tools/pw-cli.c b/src/tools/pw-cli.c index ca961973a..17878de8d 100644 --- a/src/tools/pw-cli.c +++ b/src/tools/pw-cli.c @@ -2929,11 +2929,11 @@ static void do_quit(void *data, int signal_number) static void show_help(struct data *data, const char *name) { - fprintf(stdout, "%s [options] [command]\n" + fprintf(stdout, _("%s [options] [command]\n" " -h, --help Show this help\n" " --version Show version\n" " -d, --daemon Start as daemon (Default false)\n" - " -r, --remote Remote daemon name\n\n", + " -r, --remote Remote daemon name\n\n"), name); do_help(data, "help", "", NULL);