Showing posts with label localization. Show all posts
Showing posts with label localization. Show all posts

Monday, August 11, 2014

Fitting multilungual resources in Visual Studio C++ project in user-friendly manner

Going to I18n with our MFC Visual Studio C++ projects, we were considering several methods for organizing resources, (read here for details):
  1. Language-dependent binary 
  2. One resource DLL for all languages 
  3. One resource DLL per target language 

I bet #2 is the best one, and here is how to organize .rc files and VS projects in the way good both: for machine and for humanity. Good for machine, because:
Good for humanity because:
  • resources for all languages will be capable of manual editing with Visual Studio (thus you can keep resources synchronized among different languages), 
  • It would be possible to edit TEXTINCLUDE from VS GUI.
Plenty of time spent for investigation, reading docs, exploring existing projects and collegial disputes made it possible to get desired structure of VS C++ project and .rc files. This structure might be used as a template for other projects, and even might be an Ariadne's thread in localization labyrinth.

Thursday, September 5, 2013

Why is UTF-8 treated as not multibyte?



It’s a long discussion and object of terminology. Multibyte is a slippery term and is not the best one.
Visual Studio has 3 options for characters sets:

a) No characters set, which means it works OK with single byte characters sets (SBCS) like CP1251 (ru-RU) or CP1252 (en-US)
characters take 1 byte

b) MBCS, which means it works OK with multibyte Character sets like CP936,
characters take 1 or 2 bytes, GUI accepts such characters if appropriate locale is selected in Control Panel

c) Unicode, which means working with UTF-16BE,
characters take 2 bytes, selected locale doesn’t make any sense

Note that there is no option to work with utf-8.
There are conversion functions utf8 <-> MBCS.
In Microsoft documentation term “multibyte” is related to MBCS. It was hard for me to achieve, and I suppose there could be misunderstanding among the team regarding this term.

Even having the same way of coding and having floating amount of bytes, utf8 is a way of encoding Unicode characters, it is not related to MBCS at all.

In order to have our virare and maina (it.) we’ve agreed to call MBCS multibyte

Wednesday, August 7, 2013

MultiByte, UTF-8 and Chinese Character Set



This is a result of long discussion and research of MultiByte encoding with Olga L. this morning. Keep in mind the following information when processing strings when performing localization to Chinese:
  • Multibyte is used in HyperLynx for localized strings.
  • Multibyte is not related to wide chars (wchar_t, Utf-16) at all, even having 2 bytes per character.
  • Multibyte is not related to Utf-8.
  • In Visual Studio debugger you always see Multibyte characters in case Chinese Simplified locale is selected in Control Panel
  • Multibyte (MBCS, DBCS) is the same as CodePage 936 or GB2312 in case Chinese Simplified locale is selected in Control Panel
  • getchar's _(“Two beer or not to be”) returns Multibyte string.
  • “tchar.h” routines like _tcsclen, _tcsncpy,  etc. deal with Multibyte strings
  • .po files are written in UTF-8 and converted to Multibyte on loading
  • .rc files resources are written in Win1251
  • Chinese .zh-CN.rc resources are written in CP936
  • Some of MFC Windows GUI accepts  Multibyte, some only accept ANSI or wchar_t *
Use this site to understand different encodings better, note that on Chinese locale we deal with CP936 Encoding: http://www.kreativekorp.com/charset/encoding.php