diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-06-11 20:56:30 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-21 08:20:50 +0100 |
commit | 00657aef09d854c74fb426a935a3e8b1fc390bb0 (patch) | |
tree | fd1a9bb264fe15dcc129498e62060ecd256b1ee7 /vcl/osx | |
parent | fa987cbb813cfd729fe490f2f1258b7c8d7fb174 (diff) |
migrate to boost::gettext
* all .ui files go from <interface> to <interface domain="MODULE"> e.g. vcl
* all .src files go away and the english source strings folded into the .hrc as NC_("context", "source string")
* ResMgr is dropped in favour of std::locale imbued by boost::locale::generator pointed at matching
MODULE .mo files
* UIConfig translations are folded into the module .mo, so e.g. UIConfig_cui
goes from l10n target to normal one, so the res/lang.zips of UI files go away
* translation via Translation::get(hrc-define-key, imbued-std::locale)
* python can now be translated with its inbuilt gettext support (we keep the name strings.hrc there
to keep finding the .hrc file uniform) so magic numbers can go away there
* java and starbasic components can be translated via the pre-existing css.resource.StringResourceWithLocation
mechanism
* en-US res files go away, their strings are now the .hrc keys in the source code
* remaining .res files are replaced by .mo files
* in .res/.ui-lang-zip files, the old scheme missing translations of strings
results in inserting the english original so something can be found, now the
standard fallback of using the english original from the source key is used, so
partial translations shrink dramatically in size
* extract .hrc strings with hrcex which backs onto
xgettext -C --add-comments --keyword=NC_:1c,2 --from-code=UTF-8 --no-wrap
* extract .ui strings with uiex which backs onto
xgettext --add-comments --no-wrap
* qtz for gettext translations is generated at runtime as ascii-ified crc32 of
content + "|" + msgid
* [API CHANGE] remove deprecated binary .res resouce loader related uno apis
com::sun::star::resource::OfficeResourceLoader
com::sun::star::resource::XResourceBundleLoader
com::sun::star::resource::XResourceBundle
when translating strings via uno apis
com.sun.star.resource.StringResourceWithLocation
can continue to be used
Change-Id: Ia2594a2672b7301d9c3421fdf31b6cfe7f3f8d0a
Diffstat (limited to 'vcl/osx')
-rw-r--r-- | vcl/osx/printaccessoryview.mm | 21 | ||||
-rw-r--r-- | vcl/osx/salmenu.cxx | 186 | ||||
-rw-r--r-- | vcl/osx/salsys.cxx | 2 |
3 files changed, 101 insertions, 108 deletions
diff --git a/vcl/osx/printaccessoryview.mm b/vcl/osx/printaccessoryview.mm index 2e73957b4024..3cfe816ce704 100644 --- a/vcl/osx/printaccessoryview.mm +++ b/vcl/osx/printaccessoryview.mm @@ -19,8 +19,6 @@ #include "sal/config.h" -#include "tools/resary.hxx" - #include <vcl/print.hxx> #include <vcl/image.hxx> #include <vcl/virdev.hxx> @@ -33,7 +31,8 @@ #include "quartz/utils.h" #include "svdata.hxx" -#include "svids.hrc" +#include "strings.hrc" +#include "printaccessoryview.hrc" #include "com/sun/star/i18n/XBreakIterator.hpp" #include "com/sun/star/i18n/WordType.hpp" @@ -156,31 +155,29 @@ class ControllerProperties std::vector< NSObject* > maViews; int mnNextTag; sal_Int32 mnLastPageCount; - ResStringArray maLocalizedStrings; AquaPrintPanelAccessoryController* mpAccessoryController; public: ControllerProperties( AquaPrintPanelAccessoryController* i_pAccessoryController ) : mnNextTag( 0 ) , mnLastPageCount( [i_pAccessoryController printerController]->getFilteredPageCount() ) - , maLocalizedStrings( VclResId( SV_PRINT_NATIVE_STRINGS ) ) , mpAccessoryController( i_pAccessoryController ) { - assert( maLocalizedStrings.Count() >= 5 && "resources not found" ); + assert( SAL_N_ELEMENTS(SV_PRINT_NATIVE_STRINGS) >= 5 && "resources not found" ); } rtl::OUString getMoreString() { - return maLocalizedStrings.Count() >= 4 - ? maLocalizedStrings.GetString( 3 ) - : OUString( "More" ); + return SAL_N_ELEMENTS(SV_PRINT_NATIVE_STRINGS) >= 4 + ? VclResId(SV_PRINT_NATIVE_STRINGS[3]) + : OUString("More"); } rtl::OUString getPrintSelectionString() { - return maLocalizedStrings.Count() >= 5 - ? maLocalizedStrings.GetString( 4 ) - : OUString( "Print selection only" ); + return SAL_N_ELEMENTS(SV_PRINT_NATIVE_STRINGS) >= 5 + ? VclResId(SV_PRINT_NATIVE_STRINGS[4]) + : OUString("Print selection only"); } int addNameTag( const rtl::OUString& i_rPropertyName ) diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index d943c82064bc..abab89f1dee7 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -36,7 +36,7 @@ #include "osx/salframe.h" #include "osx/a11ywrapper.h" #include "quartz/utils.h" -#include "svids.hrc" +#include "strings.hrc" #include "window.h" namespace { @@ -117,106 +117,102 @@ static void initAppMenu() { bOnce = false; - ResMgr* pMgr = ImplGetResMgr(); - if( pMgr ) + // get the main menu + NSMenu* pMainMenu = [NSApp mainMenu]; + if( pMainMenu != nil ) { - // get the main menu - NSMenu* pMainMenu = [NSApp mainMenu]; - if( pMainMenu != nil ) + // create the action selector + pMainMenuSelector = [[MainMenuSelector alloc] init]; + + // get the proper submenu + NSMenu* pAppMenu = [[pMainMenu itemAtIndex: 0] submenu]; + if( pAppMenu ) { - // create the action selector - pMainMenuSelector = [[MainMenuSelector alloc] init]; + // insert about entry + OUString aAbout(VclResId(SV_STDTEXT_ABOUT)); + NSString* pString = CreateNSString( aAbout ); + NSMenuItem* pNewItem = [pAppMenu insertItemWithTitle: pString + action: @selector(showAbout:) + keyEquivalent: @"" + atIndex: 0]; + if (pString) + [pString release]; + if( pNewItem ) + { + [pNewItem setTarget: pMainMenuSelector]; + [pAppMenu insertItem: [NSMenuItem separatorItem] atIndex: 1]; + } - // get the proper submenu - NSMenu* pAppMenu = [[pMainMenu itemAtIndex: 0] submenu]; - if( pAppMenu ) + // insert preferences entry + OUString aPref(VclResId(SV_STDTEXT_PREFERENCES)); + pString = CreateNSString( aPref ); + pNewItem = [pAppMenu insertItemWithTitle: pString + action: @selector(showPreferences:) + keyEquivalent: @"," + atIndex: 2]; + if (pString) + [pString release]; + if( pNewItem ) { - // insert about entry - OUString aAbout( ResId( SV_STDTEXT_ABOUT, *pMgr ) ); - NSString* pString = CreateNSString( aAbout ); - NSMenuItem* pNewItem = [pAppMenu insertItemWithTitle: pString - action: @selector(showAbout:) - keyEquivalent: @"" - atIndex: 0]; - if (pString) - [pString release]; - if( pNewItem ) - { - [pNewItem setTarget: pMainMenuSelector]; - [pAppMenu insertItem: [NSMenuItem separatorItem] atIndex: 1]; - } - - // insert preferences entry - OUString aPref( ResId( SV_STDTEXT_PREFERENCES, *pMgr ) ); - pString = CreateNSString( aPref ); - pNewItem = [pAppMenu insertItemWithTitle: pString - action: @selector(showPreferences:) - keyEquivalent: @"," - atIndex: 2]; - if (pString) - [pString release]; - if( pNewItem ) - { SAL_WNODEPRECATED_DECLARATIONS_PUSH - // 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 - [pNewItem setKeyEquivalentModifierMask: NSCommandKeyMask]; +// 'NSCommandKeyMask' is deprecated: first deprecated in macOS 10.12 + [pNewItem setKeyEquivalentModifierMask: NSCommandKeyMask]; SAL_WNODEPRECATED_DECLARATIONS_POP - [pNewItem setTarget: pMainMenuSelector]; - [pAppMenu insertItem: [NSMenuItem separatorItem] atIndex: 3]; - } - - // WARNING: ultra ugly code ahead - - // rename standard entries - // rename "Services" - pNewItem = [pAppMenu itemAtIndex: 4]; - if( pNewItem ) - { - pString = CreateNSString( OUString( ResId( SV_MENU_MAC_SERVICES, *pMgr ) ) ); - [pNewItem setTitle: pString]; - if( pString ) - [pString release]; - } - - // rename "Hide NewApplication" - pNewItem = [pAppMenu itemAtIndex: 6]; - if( pNewItem ) - { - pString = CreateNSString( OUString( ResId( SV_MENU_MAC_HIDEAPP, *pMgr ) ) ); - [pNewItem setTitle: pString]; - if( pString ) - [pString release]; - } - - // rename "Hide Others" - pNewItem = [pAppMenu itemAtIndex: 7]; - if( pNewItem ) - { - pString = CreateNSString( OUString( ResId( SV_MENU_MAC_HIDEALL, *pMgr ) ) ); - [pNewItem setTitle: pString]; - if( pString ) - [pString release]; - } - - // rename "Show all" - pNewItem = [pAppMenu itemAtIndex: 8]; - if( pNewItem ) - { - pString = CreateNSString( OUString( ResId( SV_MENU_MAC_SHOWALL, *pMgr ) ) ); - [pNewItem setTitle: pString]; - if( pString ) - [pString release]; - } - - // rename "Quit NewApplication" - pNewItem = [pAppMenu itemAtIndex: 10]; - if( pNewItem ) - { - pString = CreateNSString( OUString( ResId( SV_MENU_MAC_QUITAPP, *pMgr ) ) ); - [pNewItem setTitle: pString]; - if( pString ) - [pString release]; - } + [pNewItem setTarget: pMainMenuSelector]; + [pAppMenu insertItem: [NSMenuItem separatorItem] atIndex: 3]; + } + + // WARNING: ultra ugly code ahead + + // rename standard entries + // rename "Services" + pNewItem = [pAppMenu itemAtIndex: 4]; + if( pNewItem ) + { + pString = CreateNSString(VclResId(SV_MENU_MAC_SERVICES)); + [pNewItem setTitle: pString]; + if( pString ) + [pString release]; + } + + // rename "Hide NewApplication" + pNewItem = [pAppMenu itemAtIndex: 6]; + if( pNewItem ) + { + pString = CreateNSString(VclResId(SV_MENU_MAC_HIDEAPP)); + [pNewItem setTitle: pString]; + if( pString ) + [pString release]; + } + + // rename "Hide Others" + pNewItem = [pAppMenu itemAtIndex: 7]; + if( pNewItem ) + { + pString = CreateNSString(VclResId(SV_MENU_MAC_HIDEALL)); + [pNewItem setTitle: pString]; + if( pString ) + [pString release]; + } + + // rename "Show all" + pNewItem = [pAppMenu itemAtIndex: 8]; + if( pNewItem ) + { + pString = CreateNSString(VclResId(SV_MENU_MAC_SHOWALL)); + [pNewItem setTitle: pString]; + if( pString ) + [pString release]; + } + + // rename "Quit NewApplication" + pNewItem = [pAppMenu itemAtIndex: 10]; + if( pNewItem ) + { + pString = CreateNSString(VclResId(SV_MENU_MAC_QUITAPP)); + [pNewItem setTitle: pString]; + if( pString ) + [pString release]; } } } diff --git a/vcl/osx/salsys.cxx b/vcl/osx/salsys.cxx index e7870ef79bd3..7051aeedeb44 100644 --- a/vcl/osx/salsys.cxx +++ b/vcl/osx/salsys.cxx @@ -26,7 +26,7 @@ #include "osx/salinst.h" #include "quartz/utils.h" -#include "svids.hrc" +#include "strings.hrc" AquaSalSystem::~AquaSalSystem() { |