[dconf-editor] Try to handle correctly i18n.
- From: Arnaud Bonatti <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Try to handle correctly i18n.
- Date: Sun, 25 Oct 2015 18:41:58 +0000 (UTC)
commit a21c532eabc35fb363cd7913c8af3bfc713af7d7
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sun Oct 25 19:37:06 2015 +0100
Try to handle correctly i18n.
editor/dconf-model.vala | 18 +++++++++---------
editor/dconf-view.vala | 45 ++++++++++++++++++++++++++++++++++++---------
2 files changed, 45 insertions(+), 18 deletions(-)
---
diff --git a/editor/dconf-model.vala b/editor/dconf-model.vala
index a3eb36a..83eddba 100644
--- a/editor/dconf-model.vala
+++ b/editor/dconf-model.vala
@@ -170,15 +170,15 @@ public abstract class Key : SettingObject
{
case "b": return cool_boolean_text_value (variant.get_boolean (), false);
// TODO %I'xx everywhere! but would need support from the spinbutton…
- case "y": return "%hhu (%s)".printf (variant.get_byte (), variant.print (false)); // TODO i18n
problem here
- case "n": return "%'hi".printf (variant.get_int16 ());
- case "q": return "%'hu".printf (variant.get_uint16 ());
- case "i": return "%'i".printf (variant.get_int32 ()); // TODO why is 'li' failing to
display '-'?
- case "u": return "%'u".printf (variant.get_uint32 ()); // TODO is 'lu' failing also?
- case "x": return "%'lli".printf (variant.get_int64 ());
- case "t": return "%'llu".printf (variant.get_uint64 ());
- case "d": return variant.get_double ().to_string (); // TODO something; notably, number
of chars after coma
- case "h": return "%'i".printf (variant.get_handle ());
+ case "y": return "%hhu (%s)".printf (variant.get_byte (), variant.print (false));
// TODO i18n problem here
+ case "n": return "%'hi".printf (variant.get_int16 ()).locale_to_utf8 (-1, null, null, null) ??
"%hi".printf (variant.get_int16 ());
+ case "q": return "%'hu".printf (variant.get_uint16 ()).locale_to_utf8 (-1, null, null, null) ??
"%hu".printf (variant.get_uint16 ());
+ case "i": return "%'i".printf (variant.get_int32 ()).locale_to_utf8 (-1, null, null, null) ??
"%i".printf (variant.get_int32 ()); // TODO why is 'li' failing to display '-'?
+ case "u": return "%'u".printf (variant.get_uint32 ()).locale_to_utf8 (-1, null, null, null) ??
"%u".printf (variant.get_uint32 ());
+ case "x": return "%'lli".printf (variant.get_int64 ()).locale_to_utf8 (-1, null, null, null) ??
"%lli".printf (variant.get_int64 ());
+ case "t": return "%'llu".printf (variant.get_uint64 ()).locale_to_utf8 (-1, null, null, null) ??
"%llu".printf (variant.get_uint64 ());
+ case "d": return variant.get_double ().to_string ();
// TODO something; notably, number of chars after coma
+ case "h": return "%'i".printf (variant.get_handle ()).locale_to_utf8 (-1, null, null, null) ??
"%i".printf (variant.get_int32 ());
default: break;
}
if (type.has_prefix ("m"))
diff --git a/editor/dconf-view.vala b/editor/dconf-view.vala
index f9225ac..45a705f 100644
--- a/editor/dconf-view.vala
+++ b/editor/dconf-view.vala
@@ -159,15 +159,42 @@ private abstract class KeyEditorDialog : Dialog
switch (type_string)
{
// TODO %I'xx everywhere! but would need support from the spinbutton…
- case "y": min = "%hhu".printf (uint8.MIN); max = "%hhu".printf (uint8.MAX); return;
- case "n": min = "%'hi".printf (int16.MIN); max = "%'hi".printf (int16.MAX); return;
- case "q": min = "%'hu".printf (uint16.MIN); max = "%'hu".printf (uint16.MAX); return;
- case "i": min = "%'i".printf (int32.MIN); max = "%'i".printf (int32.MAX); return;
// TODO why is 'li' failing to display '-'?
- case "u": min = "%'u".printf (uint32.MIN); max = "%'u".printf (uint32.MAX); return;
// TODO is 'lu' failing also?
- case "x": min = "%'lli".printf (int64.MIN); max = "%'lli".printf (int64.MAX); return;
- case "t": min = "%'llu".printf (uint64.MIN); max = "%'llu".printf (uint64.MAX); return;
- case "d": min = double.MIN.to_string (); max = double.MAX.to_string (); return;
// TODO something
- case "h": min = "%'i".printf (int32.MIN); max = "%'i".printf (int32.MAX); return;
+ case "y":
+ min = "%hhu".printf (uint8.MIN);
+ max = "%hhu".printf (uint8.MAX);
+ return;
+ case "n":
+ min = "%'hi".printf (int16.MIN).locale_to_utf8 (-1, null, null, null) ?? "%hi".printf
(int16.MIN);
+ max = "%'hi".printf (int16.MAX).locale_to_utf8 (-1, null, null, null) ?? "%hi".printf
(int16.MAX);
+ return;
+ case "q":
+ min = "%'hu".printf (uint16.MIN).locale_to_utf8 (-1, null, null, null) ?? "%hu".printf
(uint16.MIN);
+ max = "%'hu".printf (uint16.MAX).locale_to_utf8 (-1, null, null, null) ?? "%hu".printf
(uint16.MAX);
+ return;
+ case "i":
+ min = "%'i".printf (int32.MIN).locale_to_utf8 (-1, null, null, null) ?? "%i".printf
(int32.MIN);
+ max = "%'i".printf (int32.MAX).locale_to_utf8 (-1, null, null, null) ?? "%i".printf
(int32.MAX);
+ return; // TODO why is 'li' failing to display '-'?
+ case "u":
+ min = "%'u".printf (uint32.MIN).locale_to_utf8 (-1, null, null, null) ?? "%u".printf
(uint32.MIN);
+ max = "%'u".printf (uint32.MAX).locale_to_utf8 (-1, null, null, null) ?? "%u".printf
(uint32.MAX);
+ return; // TODO is 'lu' failing also?
+ case "x":
+ min = "%'lli".printf (int64.MIN).locale_to_utf8 (-1, null, null, null) ?? "%lli".printf
(int64.MIN);
+ max = "%'lli".printf (int64.MAX).locale_to_utf8 (-1, null, null, null) ?? "%lli".printf
(int64.MAX);
+ return;
+ case "t":
+ min = "%'llu".printf (uint64.MIN).locale_to_utf8 (-1, null, null, null) ?? "%llu".printf
(uint64.MIN);
+ max = "%'llu".printf (uint64.MAX).locale_to_utf8 (-1, null, null, null) ?? "%llu".printf
(uint64.MAX);
+ return;
+ case "d":
+ min = double.MIN.to_string ();
+ max = double.MAX.to_string ();
+ return; // TODO something
+ case "h":
+ min = "%'i".printf (int32.MIN).locale_to_utf8 (-1, null, null, null) ?? "%i".printf
(int32.MIN);
+ max = "%'i".printf (int32.MAX).locale_to_utf8 (-1, null, null, null) ?? "%i".printf
(int32.MAX);
+ return;
default: assert_not_reached ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]