// SPDX-License-Identifier: MIT
#include "hello.hh"
#include <iostream>
#include <locale>
#include <stdexcept>
int main( int argc, char **argv )
{
std::locale language = std::locale::classic( );
if ( argc > 1 )
{
try
{
language = std::locale( argv[1] );
}
catch ( std::runtime_error const & )
{
std::cerr << "locale '" << argv[1] << "' is not installed, using English\n";
}
}
// The functions with a std::locale parameter pick the language from it...
std::cout << hello::WelcomeStr( "Ada", language ) << '\n'
<< hello::InboxStr( 3, 1.25, language );
// ...a streamable object from the locale of the stream it is written to.
std::cout.imbue( language );
std::cout << hello::UsageStreamable( "hello" );
}