Is it possible to export a particular game's translatable strings?

BGA localization discussions
Post Reply
User avatar
Joe
Posts: 75
Joined: 25 January 2011, 17:03

Is it possible to export a particular game's translatable strings?

Post by Joe »

The reason I am asking is because I regularly use a CAT tool for my board game translations and it allows for a Translation Memory together with a Glossary (to keep terminology consistent), among other things. As the translation tool on BGA is bare-bones, it would really help to translate the strings for a Game in a CAT tool to be consistent etc. and then import them back into BGA - and of course allow for further tweaking as-is.

Is such a thing possible - and/or could it be?

Thx!

Joe
User avatar
Een
Posts: 3854
Joined: 16 June 2010, 19:52

Re: Is it possible to export a particular game's translatable strings?

Post by Een »

I understand you are a professional translator using specialized software? Thanks for your interest in helping with translations.

Our translation system is geared up towards a community of non-professionals, and unfortunately we don't have the possibility at the moment to invest into building to/from specific software.
User avatar
Joe
Posts: 75
Joined: 25 January 2011, 17:03

Re: Is it possible to export a particular game's translatable strings?

Post by Joe »

Thx! I am an amateur (i.e. not my paying job), but already translated many boardgames 8-)

Perhaps in the future some way can be found to dump a game's strings into a file and even to develop games with external translations in mind.

Is there pergaps a way to contact a dev of one of the simpler games, to see if he can share the game's files, so that it could be determined, if a "string dump" could be done?

Thx!

Joe
User avatar
KongKing123
Posts: 577
Joined: 04 April 2020, 19:43

Re: Is it possible to export a particular game's translatable strings?

Post by KongKing123 »

Joe wrote: 26 February 2022, 16:30 Perhaps in the future some way can be found to dump a game's strings into a file and even to develop games with external translations in mind.
It's quite trivial to write a script that extracts the translation textbox contents from a single page. I'm not a JavaScript developer, but I managed to whip this up with some quick research. It might come in handy for me as well.

Code: Select all

// adapted from https://www.encodedna.com/javascript/how-to-get-all-textarea-in-a-form-using-javascript.htm
const textAreaElements = document.getElementsByTagName("textarea");
const translationPrefix = "toTranslate_";
let translationContents = "ID|Source|Translation" + "\n";

for (let i = 0; i <= textAreaElements.length - 1; i++) {
  let currentElement = textAreaElements[i];
  let currentElementId = currentElement.id;

  if (currentElementId.startsWith(translationPrefix)) {
    let translationId = currentElementId.substring(translationPrefix.length);
    let translatedElement = document.getElementById("current_" + translationId);
    translationContents += translationId + "|" +  currentElement.value + "|" + translatedElement.value + "\n"; // e.g. 90222|Enabled|Ingeschakeld
  }
}

console.log(translationContents);
You can run this from your browser's console using the developer tools (usually under the F12 key). Edit the "translationContents +=" line for different output (e.g. separators).
User avatar
Joe
Posts: 75
Joined: 25 January 2011, 17:03

Re: Is it possible to export a particular game's translatable strings?

Post by Joe »

Thx! Will try it out when I get back from vacation 8-)
Post Reply

Return to “Translations”