Difference between revisions of "Ar Tonelico III"

From Learning Languages Through Video Games
Jump to navigationJump to search
Line 7: Line 7:
 
I used Japanese IME canna under ubuntu compiled from source and changed kana-kanji dictionaries, so that kanji+furigana is written upon entering and converting Japanese text.
 
I used Japanese IME canna under ubuntu compiled from source and changed kana-kanji dictionaries, so that kanji+furigana is written upon entering and converting Japanese text.
 
I also made a ordner and a very simple script layout, which is then parsed and styled to wiki with a simple lua script.
 
I also made a ordner and a very simple script layout, which is then parsed and styled to wiki with a simple lua script.
 +
 +
I am using the following script for creating wiki sytnax from more readable file:
 +
 +
<nowiki>
 +
root    = "/home/mad_gaksha/Documents/AT3 Script/"
 +
root_out = "/home/mad_gaksha/Documents/AT3 Script (wiki)/"
 +
 +
file = "Cosmosphere/Finnel/LV04/002"
 +
 +
furi_plain = false
 +
 +
hero = "アオと"
 +
 +
--speaker abbreviations
 +
abr = {}
 +
abr["ふぃる"] = "フィンネル"
 +
 +
-- do not change from here on
 +
spcl = false
 +
heroine = ""
 +
 +
if string.find(file,"Cosmosphere") or string.find(file,"Talk_Inn") then
 +
spcl = true
 +
if string.find(file,"Saki") then
 +
  heroine = "サキ"
 +
elseif string.find(file,"Finnel") then
 +
  heroine = "フィンネル"
 +
elseif string.find(file,"Tillia") then
 +
  heroine = "ティリア"
 +
end
 +
end
 +
 +
--add html ruby syntax for furigana
 +
function insert_ruby(line)
 +
cur_line = line
 +
while string.find(cur_line,"+") do
 +
  sta = string.find(cur_line,"+")
 +
  beg = string.find(cur_line,"<",sta)
 +
  ter = string.find(cur_line,">",sta)
 +
  text = string.sub(cur_line,sta+1,beg-1)
 +
  furi = string.sub(cur_line,beg+1,ter-1)
 +
  if furi_plain then
 +
  ruby = " " .. text .. "(" .. furi .. ")"
 +
  else
 +
  ruby = "<ruby><rb>" .. text .. "</rb><rp>(</rp><rt>" .. furi .. "</rt><rp>)</rp></ruby>" 
 +
  end
 +
  cur_line = string.sub(cur_line,1,sta-1) .. ruby .. string.sub(cur_line,ter+1)
 +
end
 +
return cur_line
 +
end
 +
 +
input  = root    .. file
 +
output = root_out .. file
 +
trans= io.open(input  .. "_trans")
 +
out  = io.open(output .. "_wiki","w")
 +
trans_line = ""
 +
 +
line_no = 0
 +
 +
for line in io.lines(input) do
 +
 +
line_no = line_no+1
 +
--for syntax error in source, make locating them easier
 +
print("Now processing line " .. line_no .. ".")
 +
 +
first_char = string.sub(line,1,3)
 +
secnd_char = string.sub(line,4,6)
 +
 +
if first_char == "*" then
 +
  if secnd_char == "*" then
 +
  --comment,language explanation
 +
  out:write("*" .. insert_ruby(string.sub(line,7)) .. "\n<br>\n")
 +
  else
 +
  --contextual comment
 +
  out:write("'''CONTEXT''': " .. insert_ruby(string.sub(line,4)) .. "\n<br>\n")
 +
  end
 +
elseif first_char=="(" then
 +
  --location,time,event
 +
  out:write("==" .. insert_ruby(string.sub(line,4,#line-3)) .. "==" .. "\n<br><br>\n")
 +
elseif #line>2 then --spoken line
 +
 +
--get translated line, if existing
 +
if trans then
 +
  repeat
 +
  trans_line = trans:read()
 +
  if not trans_line then
 +
    trans = false
 +
    trans_line = "???"
 +
    break
 +
  end
 +
  until #trans_line>2 --avoid accidental spaces and empty lines
 +
else
 +
  trans_line = "???"
 +
end
 +
 +
  --get speaker
 +
  speaker = ""
 +
  if first_char == " " then
 +
  speaker = heroine
 +
  line = string.sub(line,4)
 +
  elseif first_char == "_" then
 +
  speaker = hero
 +
  line = string.sub(line,4)
 +
  else
 +
  space = string.find(line," ")
 +
  if space then
 +
    speaker = string.sub(line,1,space-1)
 +
    line = string.sub(line,space+3)
 +
    if abr[speaker] then
 +
    speaker = abr[speaker]
 +
    end
 +
  else
 +
    speaker = "[N/A]"
 +
  end
 +
  end
 +
  --print(speaker .. ": " .. line)
 +
 +
  cur_line      = line
 +
  cur_line_furi = line
 +
  while string.find(cur_line,"+") do
 +
  sta      = string.find(cur_line    ,"+")
 +
  sta_furi = string.find(cur_line_furi,"+") 
 +
  beg      = string.find(cur_line    ,"<",sta    )
 +
  beg_furi = string.find(cur_line_furi,"<",sta_furi)
 +
  ter      = string.find(cur_line    ,">",sta    )
 +
  ter_furi = string.find(cur_line_furi,">",sta_furi)
 +
  text = string.sub(cur_line,sta+1,beg-1)
 +
  furi = string.sub(cur_line,beg+1,ter-1)
 +
  cur_line      = string.sub(cur_line    ,1,sta    -1) .. text .. string.sub(cur_line    ,ter    +1)
 +
  cur_line_furi = string.sub(cur_line_furi,1,sta_furi-1) .. furi .. string.sub(cur_line_furi,ter_furi+1)
 +
  end
 +
  if string.find(cur_line,"<hym>") then
 +
  --currently only whole dialogue lines implemented in wiki syntax...
 +
  cur_line = string.gsub(cur_line,"<hym>","")
 +
  cur_line = string.gsub(cur_line,"</hym>","")
 +
  out:write("{{Hy-r-en|speaker=" .. speaker .. "\n|" .. cur_line .. "\n|" .. trans_line  .. "}}" .. "\n<br>\n")
 +
  else
 +
  out:write("{{jp-r-en|speaker=" .. speaker .. "\n|" .. cur_line .. "\n|" .. cur_line_furi .. "\n|" .. trans_line  .. "}}" .. "\n<br>\n")
 +
  end
 +
end
 +
end
 +
 +
out:close()
 +
</nowiki>

Revision as of 19:27, 6 January 2011

Lots and lots of text and lots of obscure kanji! Yeah! Done after Duke Nukem is out.

Translations

(or should I translate to German??)

Tips

I used Japanese IME canna under ubuntu compiled from source and changed kana-kanji dictionaries, so that kanji+furigana is written upon entering and converting Japanese text. I also made a ordner and a very simple script layout, which is then parsed and styled to wiki with a simple lua script.

I am using the following script for creating wiki sytnax from more readable file:

root = "/home/mad_gaksha/Documents/AT3 Script/" root_out = "/home/mad_gaksha/Documents/AT3 Script (wiki)/" file = "Cosmosphere/Finnel/LV04/002" furi_plain = false hero = "アオと" --speaker abbreviations abr = {} abr["ふぃる"] = "フィンネル" -- do not change from here on spcl = false heroine = "" if string.find(file,"Cosmosphere") or string.find(file,"Talk_Inn") then spcl = true if string.find(file,"Saki") then heroine = "サキ" elseif string.find(file,"Finnel") then heroine = "フィンネル" elseif string.find(file,"Tillia") then heroine = "ティリア" end end --add html ruby syntax for furigana function insert_ruby(line) cur_line = line while string.find(cur_line,"+") do sta = string.find(cur_line,"+") beg = string.find(cur_line,"<",sta) ter = string.find(cur_line,">",sta) text = string.sub(cur_line,sta+1,beg-1) furi = string.sub(cur_line,beg+1,ter-1) if furi_plain then ruby = " " .. text .. "(" .. furi .. ")" else ruby = "<ruby><rb>" .. text .. "</rb><rp>(</rp><rt>" .. furi .. "</rt><rp>)</rp></ruby>" end cur_line = string.sub(cur_line,1,sta-1) .. ruby .. string.sub(cur_line,ter+1) end return cur_line end input = root .. file output = root_out .. file trans= io.open(input .. "_trans") out = io.open(output .. "_wiki","w") trans_line = "" line_no = 0 for line in io.lines(input) do line_no = line_no+1 --for syntax error in source, make locating them easier print("Now processing line " .. line_no .. ".") first_char = string.sub(line,1,3) secnd_char = string.sub(line,4,6) if first_char == "*" then if secnd_char == "*" then --comment,language explanation out:write("*" .. insert_ruby(string.sub(line,7)) .. "\n<br>\n") else --contextual comment out:write("'''CONTEXT''': " .. insert_ruby(string.sub(line,4)) .. "\n<br>\n") end elseif first_char=="(" then --location,time,event out:write("==" .. insert_ruby(string.sub(line,4,#line-3)) .. "==" .. "\n<br><br>\n") elseif #line>2 then --spoken line --get translated line, if existing if trans then repeat trans_line = trans:read() if not trans_line then trans = false trans_line = "???" break end until #trans_line>2 --avoid accidental spaces and empty lines else trans_line = "???" end --get speaker speaker = "" if first_char == " " then speaker = heroine line = string.sub(line,4) elseif first_char == "_" then speaker = hero line = string.sub(line,4) else space = string.find(line," ") if space then speaker = string.sub(line,1,space-1) line = string.sub(line,space+3) if abr[speaker] then speaker = abr[speaker] end else speaker = "[N/A]" end end --print(speaker .. ": " .. line) cur_line = line cur_line_furi = line while string.find(cur_line,"+") do sta = string.find(cur_line ,"+") sta_furi = string.find(cur_line_furi,"+") beg = string.find(cur_line ,"<",sta ) beg_furi = string.find(cur_line_furi,"<",sta_furi) ter = string.find(cur_line ,">",sta ) ter_furi = string.find(cur_line_furi,">",sta_furi) text = string.sub(cur_line,sta+1,beg-1) furi = string.sub(cur_line,beg+1,ter-1) cur_line = string.sub(cur_line ,1,sta -1) .. text .. string.sub(cur_line ,ter +1) cur_line_furi = string.sub(cur_line_furi,1,sta_furi-1) .. furi .. string.sub(cur_line_furi,ter_furi+1) end if string.find(cur_line,"<hym>") then --currently only whole dialogue lines implemented in wiki syntax... cur_line = string.gsub(cur_line,"<hym>","") cur_line = string.gsub(cur_line,"</hym>","") out:write("{{Hy-r-en|speaker=" .. speaker .. "\n|" .. cur_line .. "\n|" .. trans_line .. "}}" .. "\n<br>\n") else out:write("{{jp-r-en|speaker=" .. speaker .. "\n|" .. cur_line .. "\n|" .. cur_line_furi .. "\n|" .. trans_line .. "}}" .. "\n<br>\n") end end end out:close()