Common game translations

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Common game localization

Post by ivan »

Thanks to everybody who has contributed.
Here are some translation stats:

Code: Select all

ar: 36.24229979
bg: 99.8973306
de: 66.11909651
el: 37.37166324
es: 71.35523614
fi: 93.1211499
fr: 44.35318275
he: 36.24229979
hi: 36.24229979
hu: 66.63244353
it: 63.86036961
ja: 37.37166324
ko: 36.55030801
nl: 37.06365503
pl: 46.40657084
pt: 37.37166324
pt_br: 5.954825462
ru: 39.32238193
sv: 43.83983573
zh: 37.16632444
I'm open to suggestions as to expanding the project, in particular finding a more suitable platform.
Not sure what the best solution would be, perhaps mediawiki or maybe even a custom-written web interface.
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Common game localization

Post by ivan »

New: translation files in INI format.
See original post for a download link.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Common game localization

Post by Positive07 »

The Spanish translation is %100 complete :awesome:

Can you tell us how did you get the .ini files from the Google spreadsheet? I'm impressed
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Common game localization

Post by ivan »

Positive07 wrote:The Spanish translation is %100 complete :awesome:

Can you tell us how did you get the .ini files from the Google spreadsheet? I'm impressed
Thanks so much for your help! Much appreciated!

This is the method I used (I'm afraid it's a little tedious):
First, you download the doc as a XLS file
Then export each sheet to CSV (make sure it's UTF8 format)
Save each sheet as 1.csv, 2.csv, 3.csv, etc (there are 13 sheets)
Finally run:

Code: Select all

-- Convert from CSV string to table (converts a single line of a CSV file)
function fromCSV (s)
  s = s .. ','        -- ending comma
  local t = {}        -- table to collect fields
  local fieldstart = 1
  repeat
    -- next field is quoted? (start with `"'?)
    if string.find(s, '^"', fieldstart) then
      local a, c
      local i  = fieldstart
      repeat
        -- find closing quote
        a, i, c = string.find(s, '"("?)', i+1)
      until c ~= '"'    -- quote not followed by quote?
      if not i then error('unmatched "') end
      local f = string.sub(s, fieldstart+1, i-1)
      table.insert(t, (string.gsub(f, '""', '"')))
      fieldstart = string.find(s, ',', i) + 1
    else                -- unquoted; find next comma
      local nexti = string.find(s, ',', fieldstart)
      table.insert(t, string.sub(s, fieldstart, nexti-1))
      fieldstart = nexti + 1
    end
  until fieldstart > string.len(s)
  return t
end

local sec = { "lang", "dialog", "menu", "gameplay", "score", "video", "audio", "input", "progress", "build", "chess", "date", "territory" }
local langs = { "id", "en", "ar", "bg", "de", "el", "es", "fi", "fr", "he", "hi", "hu", "it", "ja", "ko", "nl", "pt", "pt_br", "pl", "ru", "sv", "zh" }

for li, lang in ipairs(langs) do
  local out = io.open("csv/" .. lang .. ".ini", "w")
  for i = 1, #sec do
    local f = io.open("csv/" .. i .. ".csv", "r")
    out:write("[" .. sec[i] .. "]\n")
    for fields in f:lines() do
      local csv = fromCSV(fields)
      local id = csv[1]
      if id and id ~= "" then
        local e = csv[li] or ""
        e = string.gsub(e, "\n", "")
        out:write(id)
        out:write("=")
        out:write(e)
        out:write("\n")
      end
    end
    out:write("\n")
  end
end
You can change it up to export the translations in a lua table, but ini is smaller and easier to maintain.

This is the function that I use to replace the $1, $2, $3, etc flags:

Code: Select all

format = function(sz, ...)
  -- replace flags $1, $2, etc with corresponding arguments
  local n = select('#', ...)
  if n > 0 then
    for i = 1, n do
      local a = select(i, ...)
      sz = string.gsub(sz, "$" .. i, a)
    end
  end
  return sz
end
Example:

Code: Select all

sz = "$1 minutes ago"
sz2 = format(sz, 60)
Thanks so much for your help.
BTW, if you want to have your game translated just add it as another sheet in the doc.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Common game localization

Post by Positive07 »

Nice! Yeah it is a little tedious hahaha I don't usually make text based games (I hate to write) so with the basic things listed in your ini files I'm done hahaha thanks for this project really
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Common game localization

Post by ivan »

Thanks to the Steam forums, the translations are around 43% complete including a total of 23 locales.
See original post for a download link in ini format.
We still need help especially with Arabic, Greek, Dutch, Hebrew, Hindi, Japanese, Korean, Russian, Thai, Turkish and Chinese.

https://docs.google.com/spreadsheets/d/ ... edit#gid=0
User avatar
Cucurbitacée
Prole
Posts: 47
Joined: Fri Dec 14, 2012 10:22 am
Location: Frankfurt am Main

Re: Common game translations

Post by Cucurbitacée »

That's a great idea! I've noticed some mistakes and missing for the French text, I'm editing at the moment... :crazy:

EDIT: I'm done with the French translation, but in some case it will read strangely as it would require two different IDs for French where in English only one would fit.
On the same note I avoided using article that must use an elision in case the variable after it begins with a vowel. It can read a bit strange, but no need to worry with elisions. :3
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Common game translations

Post by ivan »

Thanks so much for the help! I've updated the latest snapshot of the localizations (see the first post in this thread).
Cucurbitacée wrote:EDIT: I'm done with the French translation, but in some case it will read strangely as it would require two different IDs for French where in English only one would fit.
Could you be more specific? Let me know how we can fix this so it works with the different languages.
Generally, if you need several versions of the same phrase then don't be afraid to add it to the list.
Also, if you want to have your entire game translated just add it as another sheet and we can see which phrases can be generalized.
User avatar
Cucurbitacée
Prole
Posts: 47
Joined: Fri Dec 14, 2012 10:22 am
Location: Frankfurt am Main

Re: Common game translations

Post by Cucurbitacée »

Ok, I'll try to list the "problematic" IDs:
All the following ones have a singular or plural problem depending on the value of the variable $1, if it's above 1, it should be plural. I think it can be a problem in English and most probably in other languages too for some of them.
  • loadingfn, Fichier $1/$2
  • loadingf, Fichier $1 sur $2
  • levelsc, Terminé : $1/$2
  • levelsce, Niveaux terminés : $1/$2
  • levelsbe, Bonus gagnés : $1/$2
  • levell, Parties : $1
Here are the ones that would require an article that could require an elision or another form to make the text natural to read, and of course in French the articles have gender and number agreement.
  • controlsdevice, Contrôles pour $1 : I used the preposition "pour" when I should have use "du", that would become "de la" in feminine form : Contrôles du clavier, Contrôles de la souris.
  • keyboardmd, Attribution des touches pour $1, same as above.
  • keyboardpd, Appuyez une touche sur $1, same as above.
  • keyboardrdRelâchez toutes les touches sur $1, same as above.
  • joystickmd, Attribution des bouttons pour $1, same as above.
  • joystickpd, Appuyez sur un bouton sur $1, same as above.
  • joystickrd, Relâchez tous les boutons sur $1, same as above.
I'm not sure how and if you want to implement it, a common way to do it is to add extra data (GENDER, ARTICLE, ELISION) to the variable and use a special tag before to change the word that would conflict with the variable.
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

Re: Common game translations

Post by HugoBDesigner »

Just finished the Brazilian Portuguese translation, and man... that LITERALLY took me hours to finish. The Brazilian Portuguese translation only had the countries' names, most of dates' names and just a little bit of other things (in most pages it only had ~3 translations). So I basically made 85% of all translations, at once, and took forever :P

But it is a really cool project, I hope to see it finished eventually. I may use it eventually for my next game. I hope someone also eventually get to make translations easier for game developers, like a library or something. I did something pretty easy for a mod of Mari0, in which I included translations. So, if anyone gets to make an easily readable translation file eventually, I could make a library to translate AND download language translations/translation updates.

Last, but not least, if anyone needs personal help with Brazilian Portuguese translations (for a big game, for example), just let me know. I'm totally willing to help :)
@HugoBDesigner - Twitter
HugoBDesigner - Blog
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 75 guests