Code View

# hello.msg — texts in two languages, a string function and a streamable
# class per message.
#
#   mstring hello.msg        → hello.hh, hello.cpp

$MODULE hello
$NAMESPACE hello
$INCLUDE <iomanip>

# The texts without a [language] header are English; they are also the
# fallback when the stream's locale matches none of the languages.
$LANGUAGE en

# HelloStr( ... ) returns the text; HelloStreamable( ... ) prints it with <<.
$STRING ENABLE
$STREAMABLE ENABLE

$MESSAGE Welcome
@ user std::string const &
"Welcome, {$user}!"
[tr]
"Hoş geldin, {$user}!"

# {$expression;format;...}: formats apply to this value only.
$MESSAGE Inbox
@ count int
@ size double
|You have {$count} new messages ({$size;std::fixed;std::setprecision(1)} MB).
[tr]
|{$count} yeni mesajınız var ({$size;std::fixed;std::setprecision(1)} MB).

# A multi-line text: every |line ends with a newline, a trailing \ joins.
$MESSAGE Usage
@ program char const *
|usage: {$program} [locale]
|  Prints the example messages, in the language of the given \
|locale (e.g. tr_TR.UTF-8) when it is installed.
[tr]
|kullanım: {$program} [yerel]
|  Örnek mesajları verilen yerelin (örn. tr_TR.UTF-8) dilinde \
|yazar; yerel kurulu değilse İngilizce.