18110
|
1 |
--- gobby-0.4.6/src/encoding.cpp.orig 2007-11-23 21:50:26.000000000 +0900
|
|
2 |
+++ gobby-0.4.6/src/encoding.cpp 2008-09-24 22:11:58.241855000 +0900
|
|
3 |
@@ -41,23 +41,43 @@ Glib::ustring convert_to_utf8(const std:
|
|
4 |
|
|
5 |
const std::vector<std::string>& Gobby::Encoding::get_encodings()
|
|
6 |
{
|
|
7 |
- static const std::string encodings[] = {
|
|
8 |
- "UTF-8",
|
|
9 |
- "ISO-8859-1",
|
|
10 |
- "ISO-8859-15",
|
|
11 |
- "UTF-7",
|
|
12 |
- "UTF-16",
|
|
13 |
- "UCS-2",
|
|
14 |
- "UCS-4"
|
|
15 |
- };
|
|
16 |
-
|
|
17 |
- static const std::size_t encoding_count =
|
|
18 |
- sizeof(encodings) / sizeof(encodings[0]);
|
|
19 |
-
|
|
20 |
- static std::vector<std::string> encoding_vec(
|
|
21 |
- encodings,
|
|
22 |
- encodings + encoding_count
|
|
23 |
- );
|
|
24 |
+ static std::size_t encoding_count = 0;
|
|
25 |
+ static std::vector<std::string> encoding_vec(encoding_count);
|
|
26 |
+
|
|
27 |
+ if(encoding_count != 0)
|
|
28 |
+ return encoding_vec;
|
|
29 |
+
|
|
30 |
+ static const char *encoding_list =
|
|
31 |
+ /* Translators: the msgid should not be localized.
|
|
32 |
+ * The msgstr is the list of encodings separated by bar. e.g.
|
|
33 |
+ * msgstr "EUC-JP|SHIFT-JIS|ISO-2022-JP|UTF-8|UCS-2|UCS-4" */
|
|
34 |
+ N_("UTF-8|ISO-8859-1|ISO-8859-15|UTF-7|UTF-16|UCS-2|UCS-4");
|
|
35 |
+
|
|
36 |
+ static gchar **encodings = g_strsplit(_(encoding_list), "|", 0);
|
|
37 |
+
|
|
38 |
+ encoding_count = g_strv_length(encodings);
|
|
39 |
+
|
|
40 |
+ encoding_vec.resize(encoding_count);
|
|
41 |
+ for(int i = 0; i < encoding_count; i++)
|
|
42 |
+ encoding_vec[i] = encodings[i];
|
|
43 |
+
|
|
44 |
+ g_strfreev(encodings);
|
|
45 |
+
|
|
46 |
+ static const char* current_encoding = NULL;
|
|
47 |
+ if(!g_get_charset(¤t_encoding))
|
|
48 |
+ {
|
|
49 |
+ int i;
|
|
50 |
+ for(i = 0; i < encoding_count; i++)
|
|
51 |
+ {
|
|
52 |
+ if(!strcmp(encoding_vec[i].c_str(), current_encoding))
|
|
53 |
+ break;
|
|
54 |
+ }
|
|
55 |
+ if(i == encoding_count)
|
|
56 |
+ {
|
|
57 |
+ encoding_vec.resize(++encoding_count);
|
|
58 |
+ encoding_vec[encoding_count - 1] = g_strdup(current_encoding);
|
|
59 |
+ }
|
|
60 |
+ }
|
|
61 |
|
|
62 |
return encoding_vec;
|
|
63 |
}
|
|
64 |
--- gobby-0.4.6/inc/common.hpp.orig 2008-09-24 03:10:59.654015000 +0900
|
|
65 |
+++ gobby-0.4.6/inc/common.hpp 2008-09-24 13:10:23.015627000 +0900
|
|
66 |
@@ -21,6 +21,8 @@
|
|
67 |
|
|
68 |
#include "net6/gettext_package.hpp"
|
|
69 |
|
|
70 |
+#define N_(String) (String)
|
|
71 |
+
|
|
72 |
namespace Gobby
|
|
73 |
{
|
|
74 |
|