Andrew Nguyen : ipconfig: Permit the "Yes/No" strings to be localized.

Alexandre Julliard julliard at winehq.org
Tue Sep 7 11:22:56 CDT 2010


Module: wine
Branch: master
Commit: 68a1a2678c2540125dc70660e83af79a3839a4b7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=68a1a2678c2540125dc70660e83af79a3839a4b7

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Tue Sep  7 05:01:22 2010 -0500

ipconfig: Permit the "Yes/No" strings to be localized.

---

 programs/ipconfig/En.rc      |    2 ++
 programs/ipconfig/ipconfig.c |   16 ++++++++++++----
 programs/ipconfig/ipconfig.h |    2 ++
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/programs/ipconfig/En.rc b/programs/ipconfig/En.rc
index 73f112c..6606fe4 100644
--- a/programs/ipconfig/En.rc
+++ b/programs/ipconfig/En.rc
@@ -42,4 +42,6 @@ STRINGTABLE
     STRING_DESCRIPTION, "Description"
     STRING_PHYS_ADDR, "Physical address"
     STRING_DHCP_ENABLED, "DHCP enabled"
+    STRING_YES, "Yes"
+    STRING_NO, "No"
 }
diff --git a/programs/ipconfig/ipconfig.c b/programs/ipconfig/ipconfig.c
index da63acd..84b0ace 100644
--- a/programs/ipconfig/ipconfig.c
+++ b/programs/ipconfig/ipconfig.c
@@ -229,10 +229,18 @@ static WCHAR *physaddr_to_string(WCHAR *buf, BYTE *addr, DWORD len)
     return buf;
 }
 
+static const WCHAR *boolean_to_string(int value)
+{
+    static WCHAR msg_buffer[15];
+
+    LoadStringW(GetModuleHandleW(NULL), value ? STRING_YES : STRING_NO,
+        msg_buffer, sizeof(msg_buffer)/sizeof(WCHAR));
+
+    return msg_buffer;
+}
+
 static void print_full_information(void)
 {
-    static const WCHAR yesW[] = {'Y','e','s',0};
-    static const WCHAR noW[] = {'N','o',0};
     static const WCHAR newlineW[] = {'\n',0};
 
     FIXED_INFO *info;
@@ -255,7 +263,7 @@ static void print_full_information(void)
             /* FIXME: Output primary DNS suffix. */
 
             print_field(STRING_NODE_TYPE, nodetype_to_string(info->NodeType));
-            print_field(STRING_IP_ROUTING, info->EnableRouting ? yesW : noW);
+            print_field(STRING_IP_ROUTING, boolean_to_string(info->EnableRouting));
 
             /* FIXME: Output WINS proxy status and DNS suffix search list. */
 
@@ -285,7 +293,7 @@ static void print_full_information(void)
                 print_field(STRING_CONN_DNS_SUFFIX, p->DnsSuffix);
                 print_field(STRING_DESCRIPTION, p->Description);
                 print_field(STRING_PHYS_ADDR, physaddr_to_string(physaddr_buf, p->PhysicalAddress, p->PhysicalAddressLength));
-                print_field(STRING_DHCP_ENABLED, (p->Flags & IP_ADAPTER_DHCP_ENABLED) ? yesW : noW);
+                print_field(STRING_DHCP_ENABLED, boolean_to_string(p->Flags & IP_ADAPTER_DHCP_ENABLED));
 
                 /* FIXME: Output autoconfiguration status. */
 
diff --git a/programs/ipconfig/ipconfig.h b/programs/ipconfig/ipconfig.h
index 4f9325b..d209006 100644
--- a/programs/ipconfig/ipconfig.h
+++ b/programs/ipconfig/ipconfig.h
@@ -38,3 +38,5 @@
 #define STRING_DESCRIPTION      115
 #define STRING_PHYS_ADDR        116
 #define STRING_DHCP_ENABLED     117
+#define STRING_YES              118
+#define STRING_NO               119




More information about the wine-cvs mailing list