Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
ab8d1690
Commit
ab8d1690
authored
Aug 08, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Locale now sneakily also recognizes lines marked as #_ADD
parent
560384e2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
7 deletions
+30
-7
data/chs.mse-locale/locale
data/chs.mse-locale/locale
+1
-1
data/de.mse-locale/locale
data/de.mse-locale/locale
+1
-1
data/es.mse-locale/locale
data/es.mse-locale/locale
+1
-1
data/jp.mse-locale/locale
data/jp.mse-locale/locale
+1
-1
src/data/locale.cpp
src/data/locale.cpp
+14
-0
src/util/io/reader.cpp
src/util/io/reader.cpp
+8
-2
tools/locale/merge.pl
tools/locale/merge.pl
+4
-1
No files found.
data/chs.mse-locale/locale
View file @
ab8d1690
mse
version
:
0.3.7
mse
version
:
0.3.7
installer
group
:
translations
/
Simplified
Chinese
full
name
:
简体中文
(
Simplified
Chinese
)
version
:
2008
-
07
-
03
...
...
data/de.mse-locale/locale
View file @
ab8d1690
mse
version
:
0.3.7
mse
version
:
0.3.7
installer
group
:
translations
/
Deutsch
full
name
:
Deutsch
version
:
2008
-
07
-
24
...
...
data/es.mse-locale/locale
View file @
ab8d1690
mse
version
:
0.3.7
mse
version
:
0.3.7
installer
group
:
translations
/
Espa
ñ
ol
full
name
:
Espa
ñ
ol
version
:
2008
-
05
-
31
...
...
data/jp.mse-locale/locale
View file @
ab8d1690
mse
version
:
0.3.7
mse
version
:
0.3.7
installer
group
:
translations
/
Japanese
full
name
:
日本語
(
Japanese
)
version
:
2008
-
06
-
25
...
...
src/data/locale.cpp
View file @
ab8d1690
...
...
@@ -25,6 +25,19 @@ DECLARE_TYPEOF(map<String COMMA SubLocaleP>);
// ----------------------------------------------------------------------------- : Locale class
// when reading, ignore "#_ADD" start of line pragmas
typedef
void
(
*
ReaderPragmaHandler
)(
String
&
);
DECLARE_DYNAMIC_ARG
(
ReaderPragmaHandler
,
reader_pragma_handler
);
void
ignore_add_pragma
(
String
&
str
)
{
if
(
starts_with
(
str
,
_
(
"#_ADD "
)))
str
=
str
.
substr
(
6
);
else
if
(
starts_with
(
str
,
_
(
"#_ADD"
)))
str
=
str
.
substr
(
5
);
else
if
(
starts_with
(
str
,
_
(
"#_DEL"
)))
str
.
clear
();
}
// ----------------------------------------------------------------------------- : Locale class
LocaleP
the_locale
;
String
Locale
::
typeName
()
const
{
return
_
(
"locale"
);
}
...
...
@@ -36,6 +49,7 @@ LocaleP Locale::byName(const String& name) {
IMPLEMENT_REFLECTION_NO_SCRIPT
(
Locale
)
{
REFLECT_BASE
(
Packaged
);
WITH_DYNAMIC_ARG
(
reader_pragma_handler
,
ignore_add_pragma
);
REFLECT_N
(
"menu"
,
translations
[
LOCALE_CAT_MENU
]);
REFLECT_N
(
"help"
,
translations
[
LOCALE_CAT_HELP
]);
REFLECT_N
(
"tool"
,
translations
[
LOCALE_CAT_TOOL
]);
...
...
src/util/io/reader.cpp
View file @
ab8d1690
...
...
@@ -13,6 +13,10 @@
#include <util/io/package_manager.hpp>
#undef small
typedef
void
(
*
ReaderPragmaHandler
)(
String
&
);
DECLARE_DYNAMIC_ARG
(
ReaderPragmaHandler
,
reader_pragma_handler
);
IMPLEMENT_DYNAMIC_ARG
(
ReaderPragmaHandler
,
reader_pragma_handler
,
nullptr
);
// ----------------------------------------------------------------------------- : Reader
Reader
::
Reader
(
const
InputStreamP
&
input
,
Packaged
*
package
,
const
String
&
filename
,
bool
ignore_invalid
)
...
...
@@ -225,18 +229,20 @@ void Reader::readLine(bool in_string) {
}
catch
(
const
ParseError
&
e
)
{
throw
ParseError
(
e
.
what
()
+
String
(
_
(
" on line "
))
<<
line_number
);
}
// pragma handler
if
(
reader_pragma_handler
())
reader_pragma_handler
()(
line
);
// read indentation
indent
=
0
;
while
((
UInt
)
indent
<
line
.
size
()
&&
line
.
GetChar
(
indent
)
==
_
(
'\t'
))
{
indent
+=
1
;
}
// read key / value
size_t
pos
=
line
.
find_first_of
(
_
(
':'
),
indent
);
if
(
trim
(
line
).
empty
()
||
line
.
GetChar
(
indent
)
==
_
(
'#'
))
{
if
(
line
.
find_first_not_of
(
_
(
"
\t
"
))
==
String
::
npos
||
line
.
GetChar
(
indent
)
==
_
(
'#'
))
{
// empty line or comment
key
.
clear
();
return
;
}
size_t
pos
=
line
.
find_first_of
(
_
(
':'
),
indent
);
key
=
line
.
substr
(
indent
,
pos
-
indent
);
if
(
!
ignore_invalid
&&
!
in_string
&&
starts_with
(
key
,
_
(
" "
)))
{
warning
(
_
(
"key: '"
)
+
key
+
_
(
"' starts with a space; only use TABs for indentation!"
),
0
,
false
);
...
...
tools/locale/merge.pl
View file @
ab8d1690
...
...
@@ -89,7 +89,10 @@ sub merge_locales {
if
(
$what
eq
'
a
')
{
# add
for
(
my
$k
=
0
;
$k
<
$len
;
$pos_out
++
,
$pos1
++
,
$k
++
)
{
print
"
#_ADD
",
(
$file1
[
$pos1
]
=~
/^\t/
?
''
:
'
'),
$file1
[
$pos1
];
my
$line
=
$file1
[
$pos1
];
$line
=~
s/^\xEF\xBB\xBF//
;
# eat BOM
$line
=
"
#_ADD
"
.
(
$line
=~
/^\t/
?
''
:
'
')
.
$line
;
print
$line
;
}
}
else
{
# delete
...
...
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