Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tome
Tales of MajEyal
Commits
897d1107
There was a problem fetching the pipeline summary.
Commit
897d1107
authored
5 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
i18n extractor handles factions and achievements
parent
efb8d24e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!627
I18n
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
i18n_tools/i18n_extractor.lua
+35
-14
35 additions, 14 deletions
i18n_tools/i18n_extractor.lua
with
35 additions
and
14 deletions
i18n_tools/i18n_extractor.lua
+
35
−
14
View file @
897d1107
...
...
@@ -18,7 +18,7 @@ function table.print(src, offset, ret)
-- Deep copy subtables, but not objects!
if
type
(
e
)
==
"table"
and
not
e
.
__ATOMIC
and
not
e
.
__CLASSNAME
then
print
((
"%s[%s] = {"
):
format
(
offset
,
tostring
(
k
)))
table
.
print
(
e
,
offset
..
"
"
)
table
.
print
(
e
,
offset
..
"
\t
"
)
print
((
"%s}"
):
format
(
offset
))
else
print
((
"%s[%s] = %s"
):
format
(
offset
,
tostring
(
k
),
tostring
(
e
)))
...
...
@@ -27,15 +27,7 @@ function table.print(src, offset, ret)
end
local
function
explore
(
file
,
ast
)
--[[
print("========================================")
print("========================================")
print("========================================", file)
print("========================================")
print("========================================")
table.print(ast)
print("========================================")
--]]
--table.print(ast)
for
i
,
e
in
ipairs
(
ast
)
do
if
type
(
e
)
==
"table"
then
if
e
.
tag
==
"Id"
and
e
[
1
]
==
"_t"
then
...
...
@@ -73,6 +65,26 @@ local function explore(file, ast)
locales
[
file
][
p
[
2
][
1
]]
=
{
line
=
p
[
2
].
nline
,
type
=
"entity name"
}
end
end
end
elseif
e
.
tag
==
"Id"
and
e
[
1
]
==
"newAchievement"
then
local
en
=
ast
[
i
+
1
]
if
en
then
for
j
,
p
in
ipairs
(
en
[
1
])
do
if
p
[
1
]
and
p
[
2
]
and
p
.
tag
==
"Field"
and
p
[
1
][
1
]
==
"name"
then
print
(
colors
(
"%{bright red}newAchievement"
),
p
[
2
][
1
])
locales
[
file
]
=
locales
[
file
]
or
{}
locales
[
file
][
p
[
2
][
1
]]
=
{
line
=
p
[
2
].
nline
,
type
=
"achievement name"
}
end
end
end
elseif
e
.
tag
==
"Invoke"
and
e
[
1
]
and
e
[
1
].
tag
==
"Index"
and
e
[
1
][
1
]
and
e
[
1
][
1
][
1
]
==
"engine"
and
e
[
1
][
1
].
tag
==
"Id"
and
e
[
1
][
2
][
1
]
==
"Faction"
and
e
[
1
][
2
].
tag
==
"String"
and
e
[
2
]
and
e
[
2
].
tag
==
"String"
and
e
[
2
][
1
]
==
"add"
then
local
en
=
e
[
3
]
if
en
then
for
j
,
p
in
ipairs
(
en
[
1
])
do
if
p
[
1
]
and
p
[
2
]
and
p
.
tag
==
"Field"
and
p
[
1
][
1
]
==
"name"
then
print
(
colors
(
"%{blue}newFaction"
),
p
[
2
][
1
])
locales
[
file
]
=
locales
[
file
]
or
{}
locales
[
file
][
p
[
2
][
1
]]
=
{
line
=
p
[
2
].
nline
,
type
=
"faction name"
}
end
end
end
end
explore
(
file
,
e
)
end
...
...
@@ -80,15 +92,24 @@ local function explore(file, ast)
end
local
function
dofolder
(
dir
)
local
function
handle_file
(
file
)
print
(
colors
(
"%{bright}-------------------------------------"
))
print
(
colors
(
"%{bright}-- "
..
file
))
print
(
colors
(
"%{bright}-------------------------------------"
))
explore
(
file
:
gsub
(
"%.%./"
,
""
),
p
:
parse
{
file
})
end
if
lfs
.
attributes
(
dir
,
"mode"
)
==
"file"
then
handle_file
(
dir
)
return
end
for
sfile
in
lfs
.
dir
(
dir
)
do
local
file
=
dir
..
"/"
..
sfile
if
lfs
.
attributes
(
file
,
"mode"
)
==
"directory"
and
sfile
~=
".."
and
sfile
~=
"."
then
dofolder
(
file
)
elseif
sfile
:
find
(
"%.lua$"
)
then
print
(
colors
(
"%{bright}-------------------------------------"
))
print
(
colors
(
"%{bright}-- "
..
file
))
print
(
colors
(
"%{bright}-------------------------------------"
))
explore
(
file
:
gsub
(
"%.%./"
,
""
),
p
:
parse
{
file
})
handle_file
(
file
)
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment