[cmake-developers] [DISCUSSION] CMake Localization (L10N)

Brad King brad.king at kitware.com
Wed Apr 19 13:53:02 EDT 2017


On 04/19/2017 02:52 AM, Domen Vrankar wrote:
> I somewhat understand the wish of non programmers to see text in
> their own language but for developers english is de facto programming
> standard language so I don't see a reason for such an addition.

This is a good point.  I'd be hesitant to move forward with anything
in upstream CMake without broader interest.

> Or taking that even further by defining maps:
>> set(GREETING "greeting message" "en:Hello, world!" "ru:Привет, мир!")
>> message(${GREETING}) # prints "greeting message"
>> message(${GREETING:}) # also prints "greeting message"
>> message(${GREETING:en}) # prints "Hello, world!"
>> message(${GREETING:ru}) # prints "Привет, мир!"

This can be done already in the CMake language:

```
set("en.GREETING" "Hello world!")
set("ru.GREETING" "Привет, мир!")
set(l10n ru)
message(STATUS "${${l10n}.GREETING}") # Привет, мир!
```

A macro or function could be used to improve the ergonomics of
defining the table.

-Brad



More information about the cmake-developers mailing list