From 1bb161ece5bd3a868778b7a8d4528bedaa589710 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 18 Aug 2014 11:10:25 +0100 Subject: these strings should be translatable so bring back scn.res and add them in there Change-Id: I378d64f524c64295d26223f54fe17950b475cd80 --- extensions/AllLangResTarget_scn.mk | 31 +++++++++++++++++++++++++++++++ extensions/Module_extensions.mk | 1 + extensions/source/scanner/sanedlg.cxx | 19 +++++++++++++++---- extensions/source/scanner/strings.hrc | 17 +++++++++++++++++ extensions/source/scanner/strings.src | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 extensions/AllLangResTarget_scn.mk create mode 100644 extensions/source/scanner/strings.hrc create mode 100644 extensions/source/scanner/strings.src (limited to 'extensions') diff --git a/extensions/AllLangResTarget_scn.mk b/extensions/AllLangResTarget_scn.mk new file mode 100644 index 000000000000..be69430184ec --- /dev/null +++ b/extensions/AllLangResTarget_scn.mk @@ -0,0 +1,31 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# + +$(eval $(call gb_AllLangResTarget_AllLangResTarget,scn)) + +$(eval $(call gb_AllLangResTarget_set_reslocation,scn,extensions/source/scanner)) + +$(eval $(call gb_AllLangResTarget_add_srs,scn,\ + scn/res \ +)) + +$(eval $(call gb_SrsTarget_SrsTarget,scn/res)) + +$(eval $(call gb_SrsTarget_set_include,scn/res,\ + $$(INCLUDE) \ + -I$(SRCDIR)/extensions/source/scanner \ +)) + +$(eval $(call gb_SrsTarget_add_files,scn/res,\ + extensions/source/scanner/strings.src \ +)) + +# vim:set noet sw=4 ts=4: diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk index f62ba8d4034c..de1fa1bc9610 100644 --- a/extensions/Module_extensions.mk +++ b/extensions/Module_extensions.mk @@ -19,6 +19,7 @@ $(eval $(call gb_Module_add_targets,extensions,\ $(eval $(call gb_Module_add_l10n_targets,extensions,\ AllLangResTarget_abp \ + AllLangResTarget_scn \ AllLangResTarget_upd \ UIConfig_sabpilot \ UIConfig_scanner \ diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 9a8c3b500426..c47e1a6096d9 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -28,6 +28,7 @@ #include #include #include +#include "strings.hrc" #define PREVIEW_WIDTH 113 #define PREVIEW_HEIGHT 160 @@ -241,11 +242,21 @@ SaneDlg::~SaneDlg() mrSane.SetReloadOptionsHdl( maOldLink ); } +namespace { + +ResId SaneResId( sal_uInt32 nID ) +{ + static ResMgr* pResMgr = ResMgr::CreateResMgr( "scn" ); + return ResId( nID, *pResMgr ); +} + +} + short SaneDlg::Execute() { if( ! Sane::IsSane() ) { - MessageDialog aErrorBox(NULL, "The SANE interface could not be initialized. Scanning is not possible."); + MessageDialog aErrorBox(NULL, SaneResId(STR_COULD_NOT_BE_INIT)); aErrorBox.Execute(); return sal_False; } @@ -523,7 +534,7 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton ) { if( pButton == mpDeviceInfoButton ) { - OUString aString("Device: %s\nVendor: %s\nModel: %s\nType: %s"); + OUString aString(SaneResId(STR_DEVICE_DESC)); aString = aString.replaceFirst( "%s", Sane::GetName( mrSane.GetDeviceNumber() ) ); aString = aString.replaceFirst( "%s", Sane::GetVendor( mrSane.GetDeviceNumber() ) ); aString = aString.replaceFirst( "%s", Sane::GetModel( mrSane.GetDeviceNumber() ) ); @@ -808,7 +819,7 @@ void SaneDlg::AcquirePreview() int nOption = mrSane.GetOptionByName( "preview" ); if( nOption == -1 ) { - OUString aString("The device does not offer a preview option. Therefore, a normal scan will be used as a preview instead. This may take a considerable amount of time." ); + OUString aString(SaneResId(STR_SLOW_PREVIEW)); MessageDialog aBox(this, aString, VCL_MESSAGE_WARNING, VCL_BUTTONS_OK_CANCEL); if (aBox.Execute() == RET_CANCEL) return; @@ -819,7 +830,7 @@ void SaneDlg::AcquirePreview() BitmapTransporter aTransporter; if( ! mrSane.Start( aTransporter ) ) { - MessageDialog aErrorBox(this, "An error occurred while scanning."); + MessageDialog aErrorBox(this, SaneResId(STR_ERROR_SCAN)); aErrorBox.Execute(); } else diff --git a/extensions/source/scanner/strings.hrc b/extensions/source/scanner/strings.hrc new file mode 100644 index 000000000000..209acdc9a315 --- /dev/null +++ b/extensions/source/scanner/strings.hrc @@ -0,0 +1,17 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#define STR_COULD_NOT_BE_INIT 1000 +#define STR_SLOW_PREVIEW 1001 +#define STR_ERROR_SCAN 1002 +#define STR_DEVICE_DESC 1003 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + + diff --git a/extensions/source/scanner/strings.src b/extensions/source/scanner/strings.src new file mode 100644 index 000000000000..e7c460856a51 --- /dev/null +++ b/extensions/source/scanner/strings.src @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "strings.hrc" + +String STR_COULD_NOT_BE_INIT +{ + Text = "The SANE interface could not be initialized. Scanning is not possible."; +}; + +String STR_SLOW_PREVIEW +{ + Text = "The device does not offer a preview option. Therefore, a normal scan will be used as a preview instead. This may take a considerable amount of time."; +}; + +String STR_ERROR_SCAN +{ + Text = "An error occurred while scanning."; +}; + +String STR_DEVICE_DESC +{ + Text = "Device: %s\nVendor: %s\nModel: %s\nType: %s"; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + + -- cgit