From 68a1a2678c2540125dc70660e83af79a3839a4b7 Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Tue, 7 Sep 2010 05:01:22 -0500 Subject: [PATCH] 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 73f112c54a..6606fe4402 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 da63acd011..84b0ace5e5 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 4f9325baea..d20900682a 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 -- 2.33.8