A Design for a Large Project Containing Unicode String

It has been stated before that hard-coded, literal strings are to be avoided. I disagree. There is an easy, convenient way to handle hard-coded, literal strings: use a macro directly in the code. Take a look:

    const char *msg1 = _LIT( _T("hello"), HELLO );

The _LIT macro is designed to simply return the first argument when DEBUG is defined. For release, you’d need to write a _LIT macro parser for the code to parse the _LIT macros, and create an enumerated “.h” table, and a “.dat” flat-file of literals. The flat-file can be read into an array during initialization, and all of the strings can be accessed by their index (i.e. HELLO=0). The released version of the _LIT macro might be defined as:

#define _LIT(a,b) LitArray[ b ]

You can add strings directly into your code, and not have to worry about localization. At release, the generated “.dat” file can then be translated?without changing the order of the strings.

The challenging part is making certain the strings are read in as UTF8, and that means saving the file as UTF8.

This configuration can go as far as naming the data file, based on configuration (e.g. “english.dat”, or “japanese.dat”). And applications can support multiple languages at the flip of a switch.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a