| LEFT | RIGHT |
| 1 /** | 1 /** |
| 2 * \file custom-i18n.h | 2 * \file custom-i18n.h |
| 3 */ | 3 */ |
| 4 | 4 |
| 5 #ifndef CUSTOM_I18N_H | 5 #ifndef CUSTOM_I18N_H |
| 6 #define CUSTOM_I18N_H | 6 #define CUSTOM_I18N_H |
| 7 | 7 |
| 8 #include <database.h> | 8 #include <database.h> |
| 9 | 9 |
| 10 //------------------------------------------------------- | 10 //------------------------------------------------------- |
| 11 // Message box text | 11 // Message box text |
| 12 //------------------------------------------------------- | 12 //------------------------------------------------------- |
| 13 /** | 13 /** |
| 14 * Accessor to localizable content for custom actions. | 14 * Accessor to localizable content for custom actions. |
| 15 * | 15 * |
| 16 * This class requires that the MSI contain a custom table named "AbpUIText" in
the MSI database. | 16 * This class requires that the MSI contain a custom table named "AbpUIText" in
the MSI database. |
| 17 * The WiX definition of that table is in the file "custom_i18n.wxi". | 17 * The WiX definition of that table is in the file "custom_i18n.wxi". |
| 18 * Each custom action has the responsibility for defining its own rows within th
is table. | 18 * Each custom action has the responsibility for defining its own rows within th
is table. |
| 19 */ | 19 */ |
| 20 class CustomMessageText | 20 class CustomMessageText |
| 21 { | 21 { |
| 22 Database & db ; | 22 Database & db ; |
| 23 const std::wstring component ; | 23 const std::wstring component ; |
| 24 | 24 |
| 25 public: | 25 public: |
| 26 CustomMessageText( Database & db, const std::wstring component ) | 26 CustomMessageText( Database & db, const std::wstring component ) |
| 27 : db( db ), component( component ) | 27 : db( db ), component( component ) |
| 28 {} | 28 {} |
| 29 | 29 |
| 30 std::wstring text( const std::wstring id ) | 30 std::wstring Text( const std::wstring id ) |
| 31 { | 31 { |
| 32 try { | 32 try { |
| 33 View v( db, L"SELECT `content` FROM `AbpUIText` WHERE `component`=? and `i
d`=?" ) ; | 33 View v( db, L"SELECT `content` FROM `AbpUIText` WHERE `component`=? and `i
d`=?" ) ; |
| 34 Record arg( 2 ) ; | 34 Record arg( 2 ) ; |
| 35 arg.assign_string( 1, component ) ; | 35 arg.assign_string( 1, component ) ; |
| 36 arg.assign_string( 2, id.c_str() ) ; | 36 arg.assign_string( 2, id.c_str() ) ; |
| 37 Record r( v.first( arg ) ) ; | 37 Record r( v.first( arg ) ) ; |
| 38 return r.value_string( 1 ) ; | 38 return r.value_string( 1 ) ; |
| 39 } | 39 } |
| 40 catch( ... ) | 40 catch( ... ) |
| 41 { | 41 { |
| 42 return L" " ; | 42 return L" " ; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 } ; | 45 } ; |
| 46 | 46 |
| 47 #endif | 47 #endif |
| LEFT | RIGHT |