Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
a91a7567
Kaydet (Commit)
a91a7567
authored
Eyl 30, 2011
tarafından
Andras Timar
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
extract strings for l10n from description.xml files
Merging is to be implemented...
üst
ca2235e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
8 deletions
+134
-8
tokens.h
l10ntools/inc/tokens.h
+12
-0
xrmlex.l
l10ntools/source/xrmlex.l
+25
-0
xrmmerge.cxx
l10ntools/source/xrmmerge.cxx
+97
-8
No files found.
l10ntools/inc/tokens.h
Dosyayı görüntüle @
a91a7567
...
...
@@ -98,6 +98,18 @@
#define XRM_TEXT_END 508
#define XML_TEXTCHAR 600
/*------------------------------------------------------ */
/*------------------------------------------------------ */
/* Tokens for parsing description.xml files */
/*------------------------------------------------------ */
/*------------------------------------------------------ */
#define DESC_DISPLAY_NAME_START 700
#define DESC_DISPLAY_NAME_END 701
#define DESC_TEXT_START 702
#define DESC_TEXT_END 703
#define DESC_EXTENSION_DESCRIPTION_START 704
#define DESC_EXTENSION_DESCRIPTION_END 705
#define DESC_EXTENSION_DESCRIPTION_SRC 706
#endif
...
...
l10ntools/source/xrmlex.l
Dosyayı görüntüle @
a91a7567
...
...
@@ -99,8 +99,33 @@ int bText=0;
WorkOnTokenSet( XRM_TEXT_END, yytext );
}
"<display-name>" {
WorkOnTokenSet( DESC_DISPLAY_NAME_START , yytext );
}
"</display-name>" {
WorkOnTokenSet( DESC_DISPLAY_NAME_END, yytext );
}
"<name "[^\>]*lang[^\>]*\> {
WorkOnTokenSet( DESC_TEXT_START , yytext );
}
"</name>" {
WorkOnTokenSet( DESC_TEXT_END, yytext );
}
"<extension-description>" {
WorkOnTokenSet( DESC_EXTENSION_DESCRIPTION_START , yytext );
}
"</extension-description>" {
WorkOnTokenSet( DESC_EXTENSION_DESCRIPTION_END , yytext );
}
"<src "[^\>]*lang[^\>]*\> {
WorkOnTokenSet( DESC_EXTENSION_DESCRIPTION_SRC , yytext );
}
...
...
l10ntools/source/xrmmerge.cxx
Dosyayı görüntüle @
a91a7567
...
...
@@ -37,6 +37,7 @@
#include "xrmmerge.hxx"
#include "tokens.h"
#include <iostream>
#include <fstream>
#include <vector>
using
namespace
std
;
...
...
@@ -59,12 +60,16 @@ sal_Bool bEnableExport;
sal_Bool
bMergeMode
;
sal_Bool
bErrorLog
;
sal_Bool
bUTF8
;
sal_Bool
bDisplayName
;
sal_Bool
bExtensionDescription
;
ByteString
sPrj
;
ByteString
sPrjRoot
;
ByteString
sInputFileName
;
ByteString
sActFileName
;
ByteString
sOutputFile
;
ByteString
sMergeSrc
;
ByteString
sLangAttribute
;
ByteString
sResourceType
;
String
sUsedTempFile
;
XRMResParser
*
pParser
=
NULL
;
...
...
@@ -79,6 +84,8 @@ extern char *GetOutputFile( int argc, char* argv[])
bMergeMode
=
sal_False
;
bErrorLog
=
sal_True
;
bUTF8
=
sal_True
;
bDisplayName
=
sal_False
;
bExtensionDescription
=
sal_False
;
sPrj
=
""
;
sPrjRoot
=
""
;
sInputFileName
=
""
;
...
...
@@ -296,34 +303,115 @@ int XRMResParser::Execute( int nToken, char * pToken )
switch
(
nToken
)
{
case
XRM_TEXT_START
:{
//printf("->XRM_TEXT_START\n");
ByteString
sNewLID
=
GetAttribute
(
rToken
,
"id"
);
if
(
sNewLID
!=
sLID
)
{
//EndOfText( sCurrentOpenTag, sCurrentCloseTag );
sLID
=
sNewLID
;
}
bText
=
sal_True
;
sCurrentText
=
""
;
sCurrentOpenTag
=
rToken
;
Output
(
rToken
);
//printf("<-XRM_TEXT_START\n");
}
break
;
case
XRM_TEXT_END
:
{
sCurrentCloseTag
=
rToken
;
//printf("->XRM_TEXT_END\n");
ByteString
sLang
=
GetAttribute
(
sCurrentOpenTag
,
"xml:lang"
);
sResourceType
=
ByteString
(
"readmeitem"
);
sLangAttribute
=
ByteString
(
"xml:lang"
);
ByteString
sLang
=
GetAttribute
(
sCurrentOpenTag
,
sLangAttribute
);
WorkOnText
(
sCurrentOpenTag
,
sCurrentText
);
Output
(
sCurrentText
);
EndOfText
(
sCurrentOpenTag
,
sCurrentCloseTag
);
bText
=
sal_False
;
rToken
=
ByteString
(
""
);
sCurrentText
=
ByteString
(
""
);
//printf("<-XRM_TEXT_END");
}
break
;
case
DESC_DISPLAY_NAME_START
:{
bDisplayName
=
sal_True
;
}
break
;
case
DESC_DISPLAY_NAME_END
:{
bDisplayName
=
sal_False
;
}
break
;
case
DESC_TEXT_START
:{
if
(
bDisplayName
)
{
sLID
=
ByteString
(
"dispname"
);
bText
=
sal_True
;
sCurrentText
=
""
;
sCurrentOpenTag
=
rToken
;
Output
(
rToken
);
}
}
break
;
case
DESC_TEXT_END
:
{
if
(
bDisplayName
)
{
sCurrentCloseTag
=
rToken
;
sResourceType
=
ByteString
(
"description"
);
sLangAttribute
=
ByteString
(
"lang"
);
ByteString
sLang
=
GetAttribute
(
sCurrentOpenTag
,
sLangAttribute
);
WorkOnText
(
sCurrentOpenTag
,
sCurrentText
);
Output
(
sCurrentText
);
EndOfText
(
sCurrentOpenTag
,
sCurrentCloseTag
);
bText
=
sal_False
;
rToken
=
ByteString
(
""
);
sCurrentText
=
ByteString
(
""
);
}
}
break
;
case
DESC_EXTENSION_DESCRIPTION_START
:
{
bExtensionDescription
=
sal_True
;
}
break
;
case
DESC_EXTENSION_DESCRIPTION_END
:
{
bExtensionDescription
=
sal_False
;
}
break
;
case
DESC_EXTENSION_DESCRIPTION_SRC
:
{
if
(
bExtensionDescription
)
{
sLID
=
ByteString
(
"extdesc"
);
sResourceType
=
ByteString
(
"description"
);
sLangAttribute
=
ByteString
(
"lang"
);
sCurrentOpenTag
=
rToken
;
sCurrentText
=
ByteString
(
""
);
Output
(
rToken
);
DirEntry
aEntry
(
String
(
sInputFileName
,
RTL_TEXTENCODING_ASCII_US
));
aEntry
.
ToAbs
();
ByteString
sDescFileName
(
aEntry
.
GetFull
(),
RTL_TEXTENCODING_ASCII_US
);
sDescFileName
.
SearchAndReplaceAll
(
"description.xml"
,
""
);
sDescFileName
+=
GetAttribute
(
sCurrentOpenTag
,
"xlink:href"
);
ifstream
::
pos_type
size
;
char
*
memblock
;
ifstream
file
(
sDescFileName
.
GetBuffer
(),
ios
::
in
|
ios
::
binary
|
ios
::
ate
);
if
(
file
.
is_open
())
{
size
=
file
.
tellg
();
memblock
=
new
char
[
size
];
file
.
seekg
(
0
,
ios
::
beg
);
file
.
read
(
memblock
,
size
);
file
.
close
();
sCurrentText
=
ByteString
(
memblock
);
sCurrentText
.
SearchAndReplaceAll
(
"
\n
"
,
"
\\
n"
);
delete
[]
memblock
;
}
ByteString
sLang
=
GetAttribute
(
sCurrentOpenTag
,
sLangAttribute
);
WorkOnText
(
sCurrentOpenTag
,
sCurrentText
);
sCurrentCloseTag
=
rToken
;
Output
(
sCurrentText
);
EndOfText
(
sCurrentOpenTag
,
sCurrentCloseTag
);
rToken
=
ByteString
(
""
);
sCurrentText
=
ByteString
(
""
);
}
}
break
;
default
:
if
(
bText
)
{
sCurrentText
+=
rToken
;
...
...
@@ -461,7 +549,7 @@ void XRMResExport::WorkOnText(
)
/*****************************************************************************/
{
ByteString
sLang
(
GetAttribute
(
rOpenTag
,
"xml:lang"
));
ByteString
sLang
(
GetAttribute
(
rOpenTag
,
sLangAttribute
));
if
(
!
pResData
)
{
...
...
@@ -498,7 +586,8 @@ void XRMResExport::EndOfText(
ByteString
sOutput
(
sPrj
);
sOutput
+=
"
\t
"
;
sOutput
+=
sPath
;
sOutput
+=
"
\t
0
\t
"
;
sOutput
+=
"readmeitem
\t
"
;
sOutput
+=
sResourceType
;
sOutput
+=
"
\t
"
;
sOutput
+=
pResData
->
sId
;
// USE LID AS GID OR MERGE DON'T WORK
//sOutput += pResData->sGId;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment