diff options
author | Andras Timar <atimar@suse.com> | 2011-10-29 10:41:55 +0200 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2011-10-29 10:43:44 +0200 |
commit | 6c6050237bfe6152de1371a56a65add4f70bb81c (patch) | |
tree | d90eb845d24066b6e389e6fb6777f4b6a6ce5d03 /l10ntools | |
parent | Sorry, these tests fail for me on Linux. :-( (diff) | |
download | core-6c6050237bfe6152de1371a56a65add4f70bb81c.tar.gz core-6c6050237bfe6152de1371a56a65add4f70bb81c.zip |
remove localization tool of obsoleted layout code
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/layout/README | 27 | ||||
-rw-r--r-- | l10ntools/layout/layoutparse.cxx | 142 | ||||
-rw-r--r-- | l10ntools/layout/layoutparse.hxx | 54 | ||||
-rw-r--r-- | l10ntools/layout/loc.sdf | 24 | ||||
-rw-r--r-- | l10ntools/layout/makefile.mk | 76 | ||||
-rw-r--r-- | l10ntools/layout/tralay.cxx | 415 | ||||
-rw-r--r-- | l10ntools/layout/zoom.xml | 40 | ||||
-rw-r--r-- | l10ntools/prj/build.lst | 1 | ||||
-rw-r--r-- | l10ntools/prj/d.lst | 3 |
9 files changed, 0 insertions, 782 deletions
diff --git a/l10ntools/layout/README b/l10ntools/layout/README deleted file mode 100644 index 1838e2a94ba0..000000000000 --- a/l10ntools/layout/README +++ /dev/null @@ -1,27 +0,0 @@ -Tralay - Extract and translate strings in Layout xml files. - -Translatable strings in layout xml files are attributes that have name -which starts with an underscore, eg - - _title="Set Zoom" - _label="Whole Page" - -Here is how it works - - * Extract: generate out.sdf - ../unxlngx6.pro/bin/tralay -l en-US zoom.xml > out.sdf - - * Translate: do: - cat out.sdf > trans.sdf - sed 's/en-US\t/de\tde:/' out.sdf >> trans.sdf - - * Merge: translate - ../unxlngx6.pro/bin/tralay -m trans.sdf -l de zoom.xml > zoom-DE.xml - -Running - - dmake test - -does something similar. - -
\ No newline at end of file diff --git a/l10ntools/layout/layoutparse.cxx b/l10ntools/layout/layoutparse.cxx deleted file mode 100644 index 1d8473c0926b..000000000000 --- a/l10ntools/layout/layoutparse.cxx +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "layoutparse.hxx" - -#define STRING( str ) String( str, RTL_TEXTENCODING_UTF8 ) -#define BSTRING( str ) ByteString( str, RTL_TEXTENCODING_UTF8 ) - -LayoutXMLFile::LayoutXMLFile( bool mergeMode ) - : XMLFile() - , mMergeMode( mergeMode ) -{ -} - -void -LayoutXMLFile::SearchL10NElements( XMLParentNode* pCur, int ) -{ - if ( !pCur ) - pCur = this; - - /* Recurse int children, SearchL10NElements does not do that for us. */ - if ( XMLChildNodeList* lst = pCur->GetChildList() ) - for ( size_t i = 0; i < lst->size(); i++ ) - if ( (*lst)[ i ]->GetNodeType() == XML_NODE_TYPE_ELEMENT ) - HandleElement( ( XMLElement* )(*lst)[ i ] ); - else if ( (*lst)[ i ]->GetNodeType() == XML_NODE_TYPE_COMMENT ) { - XMLChildNodeList::iterator it = lst->begin(); - ::std::advance( it, i ); - lst->erase( it ); - i--; - } -} - -std::vector<XMLAttribute*> -interestingAttributes( XMLAttributeList* lst ) -{ - std::vector<XMLAttribute*> interesting; - if ( lst ) - for ( size_t i = 0; i < lst->size(); i++ ) - if ( (*lst)[ i ]->Equals( STRING( "id" ) ) ) - interesting.insert( interesting.begin(), (*lst)[ i ] ); - else if ( ! BSTRING( *(*lst)[ i ]).CompareTo( "_", 1 ) ) - interesting.push_back( (*lst)[ i ] ); - return interesting; -} - -void -LayoutXMLFile::HandleElement( XMLElement* element ) -{ - std::vector<XMLAttribute*> interesting = interestingAttributes( element->GetAttributeList() ); - - if ( !interesting.empty() ) - { - std::vector<XMLAttribute*>::iterator i = interesting.begin(); - - ByteString id = BSTRING( (*i++)->GetValue() ); - - if ( mMergeMode ) - InsertL10NElement( id, element ); - else - for ( ; i != interesting.end(); ++i ) - { - ByteString attributeId = id; - ByteString value = BSTRING( ( *i )->GetValue() ); - XMLElement *e = new XMLElement( *element ); - e->RemoveAndDeleteAllChilds(); - /* Copy translatable text to CONTENT. */ - //new XMLData( STRING( ( *i )->GetValue() ), e, true ); - new XMLData( STRING( value ), e, true ); - attributeId += BSTRING ( **i ); - InsertL10NElement( attributeId, e ); - } - } - - SearchL10NElements( (XMLParentNode*) element ); -} - -void LayoutXMLFile::InsertL10NElement( ByteString const& id, XMLElement* element ) -{ - ByteString const language = "en-US"; - LangHashMap* languageMap = 0; - XMLHashMap::iterator pos = XMLStrings->find( id ); - if ( pos != XMLStrings->end() ) - { - languageMap = pos->second; - fprintf( stderr, "error:%s:duplicate translation found, id=%s\n", - id.GetBuffer(), BSTRING( sFileName ).GetBuffer() ); - exit( 1 ); - } - else - { - languageMap = new LangHashMap(); - XMLStrings->insert( XMLHashMap::value_type( id , languageMap ) ); - order.push_back( id ); - } - (*languageMap)[ language ] = element; -} - -sal_Bool LayoutXMLFile::Write( ByteString &aFilename ) -{ - - if ( aFilename.Len() ) - { - ofstream aFStream( aFilename.GetBuffer() , ios::out | ios::trunc ); - if ( !aFStream ) - fprintf( stderr, "ERROR: cannot open file:%s\n", aFilename.GetBuffer() ); - else - { - XMLFile::Write( aFStream ); - aFStream.close(); - return true; - } - } - return false; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/layout/layoutparse.hxx b/l10ntools/layout/layoutparse.hxx deleted file mode 100644 index a9155eaa7503..000000000000 --- a/l10ntools/layout/layoutparse.hxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef LAYOUTPARSE_HXX -#define LAYOUTPARSE_HXX - -#include "xmlparse.hxx" - -class LayoutXMLFile : public XMLFile -{ - bool mMergeMode; - -public: - LayoutXMLFile( bool mergeMode ); - - void SearchL10NElements( XMLParentNode *pCur, int pos = 0 ); - sal_Bool Write( ByteString &aFilename ); - void HandleElement( XMLElement* element ); - void InsertL10NElement( ByteString const& id, XMLElement* element ); - - using XMLFile::InsertL10NElement; - using XMLFile::Write; -}; - -std::vector<XMLAttribute*> interestingAttributes( XMLAttributeList* lst ); - -#endif /* LAYOUTPARSE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/layout/loc.sdf b/l10ntools/layout/loc.sdf deleted file mode 100644 index 023357adc420..000000000000 --- a/l10ntools/layout/loc.sdf +++ /dev/null @@ -1,24 +0,0 @@ -transex3 layout\workben\zoom-1.xml 0 help FL_ZOOM 0 en-US Zoom factor 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_WHOLE_PAGE 0 en-US Whole Page 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_PAGE_WIDTH 0 en-US Page Width 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_OPTIMAL 0 en-US Optimal 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_200 0 en-US 200 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_150 0 en-US 15~0 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_100 0 en-US 100 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_75 0 en-US 75 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_50 0 en-US 50 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_USER 0 en-US Variable 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help FL_ZOOM 0 de deZoom factor 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_WHOLE_PAGE 0 de deWhole Page 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_PAGE_WIDTH 0 de dePage Width 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_OPTIMAL 0 de deOptimal 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_200 0 de de200 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_150 0 de de15~0 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_100 0 de de100 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_75 0 de de75 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_50 0 de de50 % 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_USER 0 de deVariable 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help FL_ZOOM 0 en-US Zoom factor 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_WHOLE_PAGE 0 en-US Whole Page 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help FL_ZOOM 0 de de3:Zoom factor 20080204 13:51:01 -transex3 layout\workben\zoom-1.xml 0 help BTN_WHOLE_PAGE 0 de de3:Whole Page 20080204 13:51:01 diff --git a/l10ntools/layout/makefile.mk b/l10ntools/layout/makefile.mk deleted file mode 100644 index 1643c0d048d7..000000000000 --- a/l10ntools/layout/makefile.mk +++ /dev/null @@ -1,76 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -INCPRE=$(MISC) - -PRJNAME=l10ntools -TARGET=tralay -TARGETTYPE=CUI -LIBTARGET=no - -# --- Settings ----------------------------------------------------- - -ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : settings.mk - -.IF "$(SYSTEM_EXPAT)" == "YES" -CFLAGS+=-DSYSTEM_EXPAT -.ENDIF - -# --- Files -------------------------------------------------------- - -APP1TARGET=$(TARGET) - -OBJFILES =\ - $(OBJ)/export2.obj\ - $(OBJ)/helpmerge.obj\ - $(OBJ)/layoutparse.obj\ - $(OBJ)/merge.obj\ - $(OBJ)/tralay.obj\ - $(OBJ)/xmlparse.obj - -APP1OBJS = $(OBJFILES) -APP1RPATH = NONE -APP1STDLIBS =\ - $(COMPHELPERLIB) \ - $(TOOLSLIB)\ - $(EXPATASCII3RDLIB)\ - $(CPPULIB) \ - $(SALLIB) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -test .PHONY: - ../$(INPATH)/bin/tralay -l en-US -o out.sdf zoom.xml - cat out.sdf > trans.sdf - sed 's/en-US\t/de\tde:/' out.sdf >> trans.sdf - ../$(INPATH)/bin/tralay -m trans.sdf -l de -o zoom-DE.xml zoom.xml diff --git a/l10ntools/layout/tralay.cxx b/l10ntools/layout/tralay.cxx deleted file mode 100644 index fa3086af4359..000000000000 --- a/l10ntools/layout/tralay.cxx +++ /dev/null @@ -1,415 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <com/sun/star/xml/sax/SAXException.hpp> - -#include <osl/file.hxx> -#include <osl/process.h> - -#include <l10ntools/vosapp.hxx> - -#include "export.hxx" -#include "layoutparse.hxx" -#include "helpmerge.hxx" -#include "xmlparse.hxx" - -// Convert a rtl::OUString to a byte string. -#define OUSTRING_CSTR( str ) \ - rtl::OUStringToOString( str, RTL_TEXTENCODING_UTF8 ).getStr() - -#define STRING( str ) String( str, RTL_TEXTENCODING_UTF8 ) -#define BSTRING( str ) ByteString( str, RTL_TEXTENCODING_UTF8 ) - -using ::rtl::OUString; - -using namespace ::osl; -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - - -class TranslateLayout : public Application -{ - ByteString mGid1; - ByteString mLanguage; - ByteString mLocalize; - ByteString mOutput; - ByteString mProject; - ByteString mRoot; - bool mMergeMode; - std::vector< ByteString > mLanguages; - std::list< ByteString > mFiles; - -public: - TranslateLayout(); - virtual ~TranslateLayout(); - ByteString GetCommandLineParam( int i ); - ByteString GetOptionArgument( int const i ); - void ExceptionalMain(); - void Main(); - void Merge(); - void MergeLanguage( ByteString const& language ); - void ParseCommandLine(); - void CreateSDF(); - - using Application::GetCommandLineParam; -}; - -static void usage() -{ - fprintf( stderr, "Usage: tralay [OPTION]... XML-FILE\n" ); - fprintf( stderr, "\nOptions:\n" ); - fprintf( stderr, " -h,--help show this help\n" ); - fprintf( stderr, " -l,--language=LANG process this language\n" ); - fprintf( stderr, " -m,--merge=DATABASE.SDF translation database\n" ); - fprintf( stderr, "\nExamples:\n" ); - fprintf( stderr, " tralay -l en-US -o localize.sdf zoom.xml # Extract\n" ); - fprintf( stderr, " tralay -m localize.sdf -l de -l nl -o out zoom.xml # Merge/translate\n" ); - exit( 2 ); -} - -static ByteString ConvertSystemPath( const ByteString& rPath ) -{ - if( rPath.CompareTo( ".", 1 ) == 0 ) - { - OUString sPath( rPath.GetBuffer(), rPath.Len(), RTL_TEXTENCODING_UTF8 ); - - ::rtl::OUString curDirPth, sURL; - osl_getProcessWorkingDir( &curDirPth.pData ); - - ::osl::FileBase::getAbsoluteFileURL( curDirPth, sPath, sURL ); - ::osl::FileBase::getSystemPathFromFileURL( sURL, sPath ); - - return ByteString( rtl::OUStringToOString( sPath, RTL_TEXTENCODING_UTF8 ) ); - } - else - { - return rPath; - } -} - -ByteString TranslateLayout::GetCommandLineParam( int i ) -{ - return ByteString( OUSTRING_CSTR( Application::GetCommandLineParam( sal::static_int_cast< sal_uInt16 >( i ) ) ) ); -} - -ByteString TranslateLayout::GetOptionArgument( int const i ) -{ - if ( i >= GetCommandLineParamCount() ) - usage(); - ByteString arg = GetCommandLineParam( i ); - if ( !arg.CompareTo( "-", 1 ) ) - { - fprintf( stderr, "Option needs an argument: %s, found: %s\n", - GetCommandLineParam( i - 1 ).GetBuffer(), - arg.GetBuffer() ); - usage(); - } - return arg; - } - -void TranslateLayout::ParseCommandLine() -{ - for ( int i = 0; i < GetCommandLineParamCount(); i++ ) - { - ByteString aParam = GetCommandLineParam( i ); - if ( aParam.Equals( "-h" ) || aParam.Equals( "--help" ) ) - usage(); - else if ( aParam.Equals( "-l" ) || aParam.Equals( "--language" ) ) - mLanguages.push_back ( GetOptionArgument( ++i ) ); - else if ( aParam.Equals( "-m" ) || aParam.Equals( "--merge" ) ) - { - mMergeMode = true; - mLocalize = GetOptionArgument( ++i ); - } - else if ( aParam.Equals( "-o" ) || aParam.Equals( "--output" ) ) - mOutput = ConvertSystemPath( GetOptionArgument( ++i ) ); - else if ( !aParam.CompareTo( "-", 1 ) ) - { - fprintf( stderr, "error: No such option: %s\n", aParam.GetBuffer() ); - usage(); - } - else - mFiles.push_back( ConvertSystemPath( aParam ) ); - } - if ( mFiles.empty() ) - { - fprintf( stderr, "error: No XML-FILE found\n" ); - usage(); - } -} - -static XMLAttribute* -findAttribute( XMLAttributeList* lst, String const& name ) -{ - for ( size_t i = 0; i < lst->size(); i++ ) - if ( (*lst)[ i ]->Equals( name ) ) - return (*lst)[ i ]; - return 0; -} - -static XMLAttribute* -translateAttribute( XMLAttributeList* lst, - String const& name, String const& translation ) -{ - if ( XMLAttribute* a = findAttribute( lst, name ) ) - { - for ( XMLAttributeList::iterator it = lst->begin(); it < lst->end(); ++it ) - { - if ( *it == a ) - { - delete *it; - *it = new XMLAttribute( name.Copy( 1 ), translation ); - return *it; - } - } - } - return 0; -} - -static void -translateElement( XMLElement* element, ByteString const& lang, - ResData* resData, MergeDataFile& mergeData ) -{ - XMLAttributeList* attributes = element->GetAttributeList(); - std::vector<XMLAttribute*> interesting( interestingAttributes( attributes ) ); - - - if( !interesting.empty() ) - { - std::vector<XMLAttribute*>::iterator i( interesting.begin() ); - ByteString id = BSTRING( (*i++)->GetValue() ); - for ( ; i != interesting.end(); ++i ) - { - ByteString attributeId = id; - attributeId += BSTRING ( **i ); - resData->sGId = attributeId; - resData->sId = element->GetOldref(); - - if ( PFormEntrys* entry = mergeData.GetPFormEntrys( resData ) ) - { - ByteString translation; - entry->GetText( translation, STRING_TYP_TEXT, lang, true ); - if ( !translation.Len() ) - translation = BSTRING( ( *i )->GetValue() ); - delete translateAttribute( attributes, **i , STRING( translation ) ); - } - } - } -} - -static bool is_dir( ByteString const& name ) -{ - DirectoryItem aItem; - OUString sFileURL( name.GetBuffer(), name.Len(), RTL_TEXTENCODING_UTF8 ); - FileBase::getFileURLFromSystemPath( sFileURL, sFileURL ); - if( DirectoryItem::get( sFileURL, aItem ) == FileBase::E_None ) - { - FileStatus aStatus(osl_FileStatus_Mask_Type); - if( aItem.getFileStatus( aStatus ) == FileBase::E_None ) - { - if( aStatus.getFileType() == FileStatus::Directory ) - return true; - } - } - return false; -} - -static void make_directory( ByteString const& name ) -{ - OUString sFileURL( name.GetBuffer(), name.Len(), RTL_TEXTENCODING_UTF8 ); - FileBase::getFileURLFromSystemPath( sFileURL, sFileURL ); - Directory::create( sFileURL ); -} - -static void insertMarker( XMLParentNode *p, ByteString const& file ) -{ - if ( XMLChildNodeList* lst = p->GetChildList() ) - if ( !lst->empty() ) - { - size_t i = 1; - // Skip newline, if possible. - if ( lst->size() > 2 - && (*lst)[ 2 ]->GetNodeType() == XML_NODE_TYPE_DEFAULT ) - i++; - OUString marker = OUString(RTL_CONSTASCII_USTRINGPARAM("\n NOTE: This file has been generated automagically by transex3/layout/tralay,\n from source template: ")) - + STRING( file ) - + OUString(RTL_CONSTASCII_USTRINGPARAM(".\n Do not edit, changes will be lost.\n")); - if ( i < lst->size() ) { - XMLChildNodeList::iterator it = lst->begin(); - ::std::advance( it, i ); - lst->insert( it, new XMLComment( marker, 0 ) ); - } else { - lst->push_back( new XMLComment( marker, 0 ) ); - } - } -} - -void TranslateLayout::MergeLanguage( ByteString const& language ) -{ - ByteString xmlFile = mFiles.front(); - - MergeDataFile mergeData( mLocalize, xmlFile, - sal_False, RTL_TEXTENCODING_MS_1252 ); - - DirEntry aFile( xmlFile ); - SimpleXMLParser aParser; - LayoutXMLFile* layoutXml = new LayoutXMLFile( mMergeMode ); - if ( !aParser.Execute( aFile.GetFull() , STRING( xmlFile ), layoutXml ) ) - { - fprintf(stderr, "error: parsing: %s\n", xmlFile.GetBuffer() ); - return; - } - - layoutXml->Extract(); - insertMarker( layoutXml, xmlFile ); - - ResData resData( "", "", "" ); - resData.sResTyp = mProject; /* mGid1 ?? */ - resData.sFilename = xmlFile; - - XMLHashMap* xmlStrings = layoutXml->GetStrings(); - for ( XMLHashMap::iterator i = xmlStrings->begin(); i != xmlStrings->end(); - ++i ) - { - if ( LangHashMap* languageMap = i->second ) - if ( XMLElement* element = ( *languageMap )[ "en-US" ] ) - translateElement( element, language, &resData, mergeData ); - } - -#ifndef WNT - ByteString outFile = "/dev/stdout"; -#else - ByteString outFile = "\\\\.\\CON"; -#endif - if ( mOutput.Len() ) - { - outFile = mOutput; - if ( is_dir( outFile ) ) - { - ByteString outDir = mOutput; - outDir.Append( "/" ).Append( language ); - if ( !is_dir( outDir ) ) - make_directory( outDir ); - outFile = outDir; - outFile.Append( "/" ).Append( xmlFile ); - } - } - layoutXml->Write( outFile ); - delete layoutXml; -} - -void TranslateLayout::Merge() -{ - if (!mLanguages.empty() ) - for ( std::vector<ByteString>::iterator i = mLanguages.begin(); - i != mLanguages.end(); ++i) - MergeLanguage( *i ); - else - MergeLanguage( mLanguage ); -} - -void TranslateLayout::CreateSDF() -{ - ByteString xmlFile = mFiles.front(); -#ifndef WNT - ByteString sdf = "/dev/stdout"; -#else - ByteString sdf = "\\\\.\\CON"; -#endif - if ( mOutput.Len() ) - sdf = mOutput; - Export::SetLanguages( mLanguages ); - HelpParser::CreateSDF( sdf, mProject, mRoot, xmlFile, - new LayoutXMLFile( mMergeMode ), mGid1 ); -} - -void TranslateLayout::ExceptionalMain() -{ - ParseCommandLine(); - if ( !mLanguages.empty() ) - mLanguage = mLanguages.front(); - if ( mMergeMode ) - Merge(); - else - CreateSDF(); -} - -void TranslateLayout::Main() -{ - try - { - ExceptionalMain(); - } - catch ( xml::sax::SAXException& rExc ) - { - OString aStr( OUStringToOString( rExc.Message, - RTL_TEXTENCODING_ASCII_US ) ); - uno::Exception exc; - if (rExc.WrappedException >>= exc) - { - aStr += OString( " >>> " ); - aStr += OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ); - } - fprintf( stderr, "error: parsing: '%s'\n", aStr.getStr() ); - OSL_FAIL( aStr.getStr() ); - } - catch ( uno::Exception& rExc ) - { - OString aStr( OUStringToOString( rExc.Message, - RTL_TEXTENCODING_ASCII_US ) ); - fprintf( stderr, "error: UNO: '%s'\n", aStr.getStr() ); - OSL_FAIL( aStr.getStr() ); - } -} - -TranslateLayout::TranslateLayout() - : Application() - , mGid1( "layout" ) - , mLanguage( "en-US" ) - , mLocalize( "localize.sdf" ) - , mOutput() - , mProject( "layout" ) - , mRoot() - , mMergeMode( false ) - , mLanguages() - , mFiles() -{ -} - -TranslateLayout::~TranslateLayout() -{ -} - -SAL_IMPLEMENT_MAIN() -{ - TranslateLayout t; - t.Main(); - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/layout/zoom.xml b/l10ntools/layout/zoom.xml deleted file mode 100644 index 0fb3d27343ff..000000000000 --- a/l10ntools/layout/zoom.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- This is a template. i18n translation is not performed in-place; - i18n translated xml files are generated from this template by - transex3/layout/tralay. !--> - -<modaldialog xmlns="http://openoffice.org/2007/layout" - xmlns:cnt="http://openoffice.org/2007/layout/container" - id="dialog" _title="Set Zoom" _label="boe" optimumsize="true" - help-id="SID_ATTR_ZOOM" - has_border="true" sizeable="true" moveable="true"> - <vbox spacing="5" border="5"> - <fixedline id="FL_ZOOM" _text="Zoom factor" _tooltip="bah" cnt:expand="true"/> - <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" _label="Whole Page"/> - <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" _label="Page Width"/> - <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" _label="Optimal"/> - <radiobutton radiogroup="zoom" id="BTN_200" _label="200 %"/> - <radiobutton radiogroup="zoom" id="BTN_150" _label="15~0 %"/> - <radiobutton radiogroup="zoom" id="BTN_100" _label="100 %"/> - <radiobutton radiogroup="zoom" id="BTN_75" _label="75 %"/> - <radiobutton radiogroup="zoom" id="BTN_50" _label="50 %"/> - <hbox cnt:expand="false" cnt:fill="true"> - <align cnt:expand="false" cnt:fill="true"> - <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" _label="Variable"/> - </align> - <flow cnt:padding="10" cnt:expand="false"/> - <metricfield id="ED_USER" value-step="1" - repeat="true" has_border="true" spin="true" - text="100%" unit="13" custom-unit-text="%" - right="true" - cnt:expand="false"/> - </hbox> - <fixedline cnt:padding="1" id="FL_BOTTOM"/> - <dialogbuttonhbox border="5" spacing="5"> - <flow/> - <okbutton id="BTN_ZOOM_OK"/> - <cancelbutton id="BTN_ZOOM_CANCEL"/> - <helpbutton id="BTN_ZOOM_HELP"/> - </dialogbuttonhbox> - </vbox> -</modaldialog> diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst index acd989c9e129..3cce7a3eee5f 100644 --- a/l10ntools/prj/build.lst +++ b/l10ntools/prj/build.lst @@ -2,7 +2,6 @@ tr l10ntools : tools LIBXSLT:libxslt BERKELEYDB:berkeleydb LUCENE:lucene NULL tr l10ntools usr1 - all tr_mkout NULL tr l10ntools\inc nmake - all tr_inc NULL tr l10ntools\source nmake - all tr_src tr_inc NULL -tr l10ntools\layout nmake - all rt_layout tr_src tr_inc NULL tr l10ntools\source\help nmake - all tr_bla_help NULL tr l10ntools\source\filter\utils nmake - all tr_bla_utils NULL tr l10ntools\source\filter\merge nmake - all tr_bla_merge tr_bla_utils NULL diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst index be38c93591ee..5bbc5baf1282 100644 --- a/l10ntools/prj/d.lst +++ b/l10ntools/prj/d.lst @@ -24,12 +24,9 @@ mkdir: %_DEST%\bin\help\com\sun\star\help ..\%__SRC%\bin\ulfex %_DEST%\bin\ulfex ..\%__SRC%\bin\txtconv.exe %_DEST%\bin\txtconv.exe ..\%__SRC%\bin\txtconv %_DEST%\bin\txtconv -..\%__SRC%\bin\tralay.exe %_DEST%\bin\tralay.exe -..\%__SRC%\bin\tralay %_DEST%\bin\tralay ..\%__SRC%\bin\ulfconv %_DEST%\bin\ulfconv ..\%__SRC%\class\FCFGMerge.jar %_DEST%\bin\FCFGMerge.jar ..\%__SRC%\class\HelpIndexerTool.jar %_DEST%\bin\HelpIndexerTool.jar -..\%__SRC%\class\jpropex\jpropex.jar %_DEST%\bin\jpropex.jar ..\%__SRC%\bin\HelpLinker %_DEST%\bin\HelpLinker ..\%__SRC%\bin\HelpCompiler %_DEST%\bin\HelpCompiler ..\%__SRC%\bin\HelpCompiler.exe %_DEST%\bin\HelpCompiler.exe |