GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
LanguagePicker.cpp
Go to the documentation of this file.
1
2#include <Wt/WApplication.h>
3
4#include "LanguagePicker.h"
5
6namespace {
7
8/*
9** These are language-picker items used in the combo-box
10** language selector in the top of the site menu bar.
11** Each 'lauguage' requires a corresponding gcw_lang.xml
12** file that contains all of the translated strings.
13**
14*/
15std::vector< std::vector< std::string > > langItems =
16{
17 { "en" , "English" },
18 { "en_cb" , "Cowboy" },
19 { "nl" , "Netherlands" },
20};
21
22} // endnamespace {
23
26{
27 /*
28 ** Load the language choices in the combo box
29 **
30 */
31 for( auto & item : langItems )
32 addItem( item.at(1) );
33
34 /*
35 ** when activated, change the language
36 **
37 */
38 activated().connect( [&]( int _selection )
39 {
40 wApp-> setLocale( langItems.at( _selection ).at(0) );
41 });
42
43} // endLanguagePicker()
44
45
46
Signal< int > & activated()
void addItem(const WString &text)