]> code.delx.au - pulseaudio/commitdiff
add a bit of missing i18n
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Feb 2009 20:56:52 +0000 (21:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Feb 2009 20:56:52 +0000 (21:56 +0100)
src/pulse/channelmap.c
src/pulse/sample.c

index 6ff30c26e8a380a0c5374ec1e0b3d2388f94f143..43e5f83d800cd1e280d5c3fde90b424b2f9344e6 100644 (file)
@@ -434,11 +434,11 @@ const char* pa_channel_position_to_string(pa_channel_position_t pos) {
 
 const char* pa_channel_position_to_pretty_string(pa_channel_position_t pos) {
 
-    pa_init_i18n();
-
     if (pos < 0 || pos >= PA_CHANNEL_POSITION_MAX)
         return NULL;
 
+    pa_init_i18n();
+
     return _(pretty_table[pos]);
 }
 
@@ -502,19 +502,19 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
      * "mono" here explicitly, because that can be understood as
      * listing with one channel called "mono". */
 
-    if (strcmp(s, "stereo") == 0) {
+    if (pa_streq(s, "stereo")) {
         map.channels = 2;
         map.map[0] = PA_CHANNEL_POSITION_LEFT;
         map.map[1] = PA_CHANNEL_POSITION_RIGHT;
         goto finish;
-    } else if (strcmp(s, "surround-40") == 0) {
+    } else if (pa_streq(s, "surround-40")) {
         map.channels = 4;
         map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
         map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
         map.map[2] = PA_CHANNEL_POSITION_REAR_LEFT;
         map.map[3] = PA_CHANNEL_POSITION_REAR_RIGHT;
         goto finish;
-    } else if (strcmp(s, "surround-41") == 0) {
+    } else if (pa_streq(s, "surround-41")) {
         map.channels = 5;
         map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
         map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
@@ -522,7 +522,7 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
         map.map[3] = PA_CHANNEL_POSITION_REAR_RIGHT;
         map.map[4] = PA_CHANNEL_POSITION_LFE;
         goto finish;
-    } else if (strcmp(s, "surround-50") == 0) {
+    } else if (pa_streq(s, "surround-50")) {
         map.channels = 5;
         map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
         map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
@@ -530,7 +530,7 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
         map.map[3] = PA_CHANNEL_POSITION_REAR_RIGHT;
         map.map[4] = PA_CHANNEL_POSITION_FRONT_CENTER;
         goto finish;
-    } else if (strcmp(s, "surround-51") == 0) {
+    } else if (pa_streq(s, "surround-51")) {
         map.channels = 6;
         map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
         map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
@@ -539,7 +539,7 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
         map.map[4] = PA_CHANNEL_POSITION_FRONT_CENTER;
         map.map[5] = PA_CHANNEL_POSITION_LFE;
         goto finish;
-    } else if (strcmp(s, "surround-71") == 0) {
+    } else if (pa_streq(s, "surround-71")) {
         map.channels = 8;
         map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
         map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
@@ -563,13 +563,13 @@ pa_channel_map *pa_channel_map_parse(pa_channel_map *rmap, const char *s) {
         }
 
         /* Some special aliases */
-        if (strcmp(p, "left") == 0)
+        if (pa_streq(p, "left"))
             map.map[map.channels++] = PA_CHANNEL_POSITION_LEFT;
-        else if (strcmp(p, "right") == 0)
+        else if (pa_streq(p, "right"))
             map.map[map.channels++] = PA_CHANNEL_POSITION_RIGHT;
-        else if (strcmp(p, "center") == 0)
+        else if (pa_streq(p, "center"))
             map.map[map.channels++] = PA_CHANNEL_POSITION_CENTER;
-        else if (strcmp(p, "subwoofer") == 0)
+        else if (pa_streq(p, "subwoofer"))
             map.map[map.channels++] = PA_CHANNEL_POSITION_SUBWOOFER;
         else {
             pa_channel_position_t i;
@@ -784,6 +784,8 @@ const char* pa_channel_map_to_pretty_name(const pa_channel_map *map) {
     for (c = 0; c < map->channels; c++)
         pa_bitset_set(in_map, map->map[c], TRUE);
 
+    pa_init_i18n();
+
     if (pa_bitset_equals(in_map, PA_CHANNEL_POSITION_MAX,
                          PA_CHANNEL_POSITION_MONO, -1))
         return _("Mono");
index a6c77345393cb07ee512e0cb2f0822821021d7ce..5528a591a26db653d6b3e9621b375b425620b96b 100644 (file)
@@ -151,22 +151,25 @@ char *pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec) {
     if (!pa_sample_spec_valid(spec))
         pa_snprintf(s, l, _("(invalid)"));
     else
-        pa_snprintf(s, l, "%s %uch %uHz", pa_sample_format_to_string(spec->format), spec->channels, spec->rate);
+        pa_snprintf(s, l, _("%s %uch %uHz"), pa_sample_format_to_string(spec->format), spec->channels, spec->rate);
 
     return s;
 }
 
 char* pa_bytes_snprint(char *s, size_t l, unsigned v) {
     pa_assert(s);
+    pa_assert(l > 0);
+
+    pa_init_i18n();
 
     if (v >= ((unsigned) 1024)*1024*1024)
-        pa_snprintf(s, l, "%0.1f GiB", ((double) v)/1024/1024/1024);
+        pa_snprintf(s, l, _("%0.1f GiB"), ((double) v)/1024/1024/1024);
     else if (v >= ((unsigned) 1024)*1024)
-        pa_snprintf(s, l, "%0.1f MiB", ((double) v)/1024/1024);
+        pa_snprintf(s, l, _("%0.1f MiB"), ((double) v)/1024/1024);
     else if (v >= (unsigned) 1024)
-        pa_snprintf(s, l, "%0.1f KiB", ((double) v)/1024);
+        pa_snprintf(s, l, _("%0.1f KiB"), ((double) v)/1024);
     else
-        pa_snprintf(s, l, "%u B", (unsigned) v);
+        pa_snprintf(s, l, _("%u B"), (unsigned) v);
 
     return s;
 }