@@ -36,8 +36,8 @@ void Sample::Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTAT
3636 int retVal = GetUserDefaultLocaleName (m_localeName, ARRAYSIZE (m_localeName));
3737 if (retVal == 0 )
3838 throw std::exception (" Failed to get locale in CreateDeviceDependenciesResources" );
39- swprintf_s (m_imagePrepend, _countof (m_imagePrepend), L" Assets\\ Images\\ %s \\ " , m_localeName);
40- swprintf_s (m_resFileName, _countof (m_resFileName), L" Assets\\ Resources\\ %s .resources" , m_localeName);
39+ swprintf_s (m_imagePrepend, _countof (m_imagePrepend), L" Assets\\ Images\\ %ls \\ " , m_localeName);
40+ swprintf_s (m_resFileName, _countof (m_resFileName), L" Assets\\ Resources\\ %ls .resources" , m_localeName);
4141
4242 m_deviceResources->CreateDeviceResources ();
4343 CreateDeviceDependentResources ();
@@ -59,7 +59,7 @@ void Sample::InitializeLocalization()
5959 // Get Package Details using the Package Id
6060 Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
6161 Windows::ApplicationModel::PackageId^ packageId = package->Id ;
62- m_textConsole->Format (L" The Package Full Name is: %s \n " , packageId->FullName ->Data ());
62+ m_textConsole->Format (L" The Package Full Name is: %ls \n " , packageId->FullName ->Data ());
6363
6464 // Get the locale name for the system using GetUserDefaultLocaleName(). This will return the locale selected through the
6565 // Settings app only if that locale has been added to the Resources section of the application's package manifest.
@@ -69,7 +69,7 @@ void Sample::InitializeLocalization()
6969 int retVal = GetUserDefaultLocaleName (userLocaleName, ARRAYSIZE (userLocaleName));
7070 if (FunctionSucceeded (retVal, L" GetUserDefaultLocaleName" ))
7171 {
72- swprintf_s (message, L" GetUserDefaultLocaleName succeeded: %s \n " , userLocaleName);
72+ swprintf_s (message, L" GetUserDefaultLocaleName succeeded: %ls \n " , userLocaleName);
7373 OutputDebugString (message);
7474 m_textConsole->Write (message);
7575 }
@@ -93,14 +93,14 @@ void Sample::InitializeLocalization()
9393 throw std::exception (" LocaleNameToLCID failed!" );
9494 }
9595
96- // The GetUserGeoID() API can be used to get the actual country the kit is in.
97- // It gives you the country selected through the Settings app
96+ // The GetUserGeoID() API can be used to get the actual country/region the kit is in.
97+ // It gives you the country/region selected through the Settings app
9898 long geoID = GetUserGeoID (GEOCLASS_NATION);
9999 wchar_t geoData[LOCALE_NAME_MAX_LENGTH];
100100 retVal = GetGeoInfoW (geoID, GEO_LATITUDE, geoData, ARRAYSIZE (geoData), primary);
101101 if (FunctionSucceeded (retVal, L" GetGeoInfoW" ))
102102 {
103- swprintf_s (message, L" Lattitude query succeeded: %s \n " , geoData);
103+ swprintf_s (message, L" Lattitude query succeeded: %ls \n " , geoData);
104104 OutputDebugString (message);
105105 m_textConsole->Write (message);
106106 }
@@ -112,7 +112,7 @@ void Sample::InitializeLocalization()
112112 retVal = GetGeoInfoW (geoID, GEO_LONGITUDE, geoData, ARRAYSIZE (geoData), primary);
113113 if (FunctionSucceeded (retVal, L" GetGeoInfoW" ))
114114 {
115- swprintf_s (message, L" Longitude query succeeded: %s \n " , geoData);
115+ swprintf_s (message, L" Longitude query succeeded: %ls \n " , geoData);
116116 OutputDebugString (message);
117117 m_textConsole->Write (message);
118118 }
@@ -124,7 +124,7 @@ void Sample::InitializeLocalization()
124124 retVal = GetGeoInfoW (geoID, GEO_NATION, geoData, ARRAYSIZE (geoData), primary);
125125 if (FunctionSucceeded (retVal, L" GetGeoInfoW" ))
126126 {
127- swprintf_s (message, L" Nation query succeeded: %s \n " , geoData);
127+ swprintf_s (message, L" Nation query succeeded: %ls \n " , geoData);
128128 OutputDebugString (message);
129129 m_textConsole->Write (message);
130130 }
@@ -137,7 +137,7 @@ void Sample::InitializeLocalization()
137137 retVal = GetGeoInfoW (geoID, GEO_ISO2, iso2, ARRAYSIZE (iso2), primary);
138138 if (FunctionSucceeded (retVal, L" GetGeoInfoW" ))
139139 {
140- swprintf_s (message, L" Iso2 query succeeded: %s \n " , iso2);
140+ swprintf_s (message, L" Iso2 query succeeded: %ls \n " , iso2);
141141 OutputDebugString (message);
142142 m_textConsole->Write (message);
143143 }
@@ -150,7 +150,7 @@ void Sample::InitializeLocalization()
150150 retVal = GetGeoInfoW (geoID, GEO_ISO3, iso3, ARRAYSIZE (iso3), primary);
151151 if (FunctionSucceeded (retVal, L" GetGeoInfoW" ))
152152 {
153- swprintf_s (message, L" Iso3 query succeeded: %s \n " , iso3);
153+ swprintf_s (message, L" Iso3 query succeeded: %ls \n " , iso3);
154154 OutputDebugString (message);
155155 m_textConsole->Write (message);
156156 }
@@ -159,25 +159,25 @@ void Sample::InitializeLocalization()
159159 throw std::exception (" GetGeoInfoW failed on GEO_ISO3!" );
160160 }
161161
162- // The country values returned from GetUserDefaultLocaleName() and GetUserGeoID() can be compared
163- // to determine if the country selected by the user is supported by the app or not
162+ // The country/region values returned from GetUserDefaultLocaleName() and GetUserGeoID() can be compared
163+ // to determine if the country/region selected by the user is supported by the app or not
164164 std::wstring localeNameStr (userLocaleName);
165165 std::wstring::size_type pos = localeNameStr.find (L' -' );
166166 localeNameStr = localeNameStr.substr (pos + 1 );
167167 if (_wcsicmp (localeNameStr.c_str (), iso2) == 0 || _wcsicmp (localeNameStr.c_str (), iso3) == 0 )
168168 {
169- m_textConsole->Format (L" Selected locale in manifest. Country: %s \n " , iso2);
169+ m_textConsole->Format (L" Selected locale in manifest. Country/region : %ls \n " , iso2);
170170 }
171171 else
172172 {
173- m_textConsole->Format (L" The selected locale (Country: %s) is NOT present in the manifest, so the fallback locale (Country: %s ) is selected for localization\n " , iso2, localeNameStr.c_str ());
173+ m_textConsole->Format (L" The selected locale (Country/region : %s) is NOT present in the manifest, so the fallback locale (Country: %ls ) is selected for localization\n " , iso2, localeNameStr.c_str ());
174174}
175175
176176 wchar_t lcpData[LOCALE_NAME_MAX_LENGTH];
177177 retVal = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, lcpData, ARRAYSIZE (lcpData));
178178 if (FunctionSucceeded (retVal, L" GetLocaleInfoEx" ))
179179 {
180- m_textConsole->Format (L" GetLocaleInfoEx() - LOCALE_SISO639LANGNAME: %s \n " , lcpData);
180+ m_textConsole->Format (L" GetLocaleInfoEx() - LOCALE_SISO639LANGNAME: %ls \n " , lcpData);
181181 }
182182 else
183183 {
@@ -187,7 +187,7 @@ void Sample::InitializeLocalization()
187187 retVal = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE, lcpData, ARRAYSIZE (lcpData));
188188 if (FunctionSucceeded (retVal, L" GetLocaleInfoEx" ))
189189 {
190- m_textConsole->Format (L" GetLocaleInfoEx() - LOCALE_IDEFAULTLANGUAGE: %s \n " , lcpData);
190+ m_textConsole->Format (L" GetLocaleInfoEx() - LOCALE_IDEFAULTLANGUAGE: %ls \n " , lcpData);
191191 }
192192 else
193193 {
@@ -389,7 +389,7 @@ bool Sample::FunctionSucceeded(int returned, const wchar_t* function)
389389 {
390390 unsigned long error = GetLastError ();
391391 wchar_t message[1024 ] = { L' \0 ' };
392- swprintf_s (message, L" %s failed with error: %u\n " , function, error);
392+ swprintf_s (message, L" %ls failed with error: %u\n " , function, error);
393393 OutputDebugString (message);
394394 return false ;
395395 }
0 commit comments