Interface Translations - Convert xls to txt for import/export to/from SAB

I’ve requested that SAB be able to import/export .xlsx spreadsheets for the Interface Translations.

However, I’m wondering if anyone has converted an .xlsx to the .txt format expected by import/export Interface Translations? That would be really helpful if so!

1 Like

Just a note… When you export the interface to a text file you get a “sparse matrix”. Some UI strings have around 20 different languages, but some just have a few like these:

$ Text_On_Image_Saved
en: Image saved
fr: Image enregistrée
es: Imagen grabada
ru: Изображение сохранено
id: Gambar telah disimpan

$ Text_On_Image_Video_Saved
en: Video saved
fr: Vidéo enregistrée
id: Video telah disimpan

$ Text_On_Image_Save_Image
en: Save Image
fr: Enregistrer image
id: Simpan Gambar

So turning this into a spreadsheet would require identifying all of the languages first, setting up a column for each language, and then putting the data in the proper column. I’m not volunteering anything, just further defining the problem…

I have some scripts similar to this but not exactly what you are asking for. But I am off on vacation for two weeks so check back with me in three weeks if you don’t get anything else.

@ChrisHubbard Do you have scripts for handling this?

@ChrisHubbard @mcquayi @jeff_heath anyone else…is there a trick for getting Interface >> Translations >> Import to work?

I’ve exported an example and I’ve figured out a way to change my Excel spreadsheet into the format expected by SAB…but import does not appear to do anything. I had 2-3 fully populated interface custom languages and no updates happen when I import. I even removed the custom languages and re-created them so they are empty now and import clearly is not importing the text file.

No error message. No apparent result from importing. I may need to just copy and paste by hand anyway unless there’s something I’m overlooking…

I do not have a script and I don’t have any experience with this. Sorry.

Using @jeff_heath’s example above I would add tabs in:

$ Text_On_Image_Saved	en: 	Image saved	fr: 	Image enregistrée	es: 	Imagen grabada	ru: 	Изображение сохранено	id: 	Gambar telah disimpan
$ Text_On_Image_Video_Saved	en: 	Video saved	fr: 	Vidéo enregistrée					id: 	Video telah disimpan
$ Text_On_Image_Save_Image	en: 	Save Image	fr: 	Enregistrer image					id: 	Simpan Gambar

and copy this into a spreadsheet

To convert it back:

  • Copy/paste into text document
  • Regex replace (: )\t with \1
    (Replace the colon-space-tab with colon-space)
  • Regex replace \t with \r\n
    (Replace tab with enter)
  • Regex replace (\$) with \r\n\1
    (Replace dollar with enter-dollar)

*Notepad++ allows for regex find/replace.

You will probably have to add the lines

$ Language_[your language code]
[your language code]: [your language name]

e.g.

$ Language_zu
zu: IsiZulu

If anyone can make this into a script or build it into SAB, please share.

Thanks for sharing this - since I first posted, I had figured out how to do something similar to what you described.

Interesting that you copied the information out of Excel and back into the text document. That is good for me to try to see if it helps another issue - 2 of my custom languages use an Arabic based script and the regular save of a CSV or tab limited txt file out of Excel was rendering nearly all of the custom language translations as ???. I was able to make it work by saving as a “Unicode Text File”.

I then used Notepad++ to manipulate the file similarly to you. I used Replace with “Search Mode” being “Extended” rather than “Regular Expression” and only replaced \t with \n but I see you replace \t with \r\n - I’m not technical enough to know the difference. My manipulated file appears like the file exported from SAB. However, when I try to import my manipulated file, nothing appears to happen and there is no error. Perhaps the difference between \r\n and \n is causing this issue?

@GregAshleyCooper can you confirm that “Importing” your manipulated txt file actually works? I’m a bit confused over here…nothing is changing in my list of translations when I try to import my manipulated file. And if I delete my custom languages, importing the file also doesn’t do anything…

Edit:
I just exported the translations file and manually changed some text in English, French (which I don’t normally have turned on but wanted to see if importing would change it), and one of my custom languages (because I wanted to verify that the custom languages would be updated, not just languages included in SAB). These all worked so the problem of not importing has to do either with hidden characters in my manipulated file OR that my manipulated file does not have all the default languages…

@GregAshleyCooper appreciate you looking at this and any further input/recommendations you can provide. And yes, I agree…it would be great if the Interface Translations Import\Export could be more “feature rich”

After playing around with it a bit more, I finally got the import to work after making 2 more changes/corrections. (I’m not sure which one or both actually made the import work)

Change 1: Made sure the comments and [Translations] line from the Exported text file were included and removed the column headers I had added in Excel

Change 2: I’m not sure if order matters but in my original spreadsheet, I had a custom Arabic translation list that appeared after my two main custom languages. However, I noticed in the Exported version from SAB that the custom Arabic translations were before the custom languages (i.e. my two truly custom languages were last in the list in the exported translations). So I reordered my spreadsheet columns to be Phrase ID >> en >> ar >> custom1 >> custom2 and made the regular expression replacements suggested by @GregAshleyCooper (except I didn’t do the first one * Regex replace (: )\t with \1(Replace the colon-space-tab with colon-space) because it didn’t seem necessary or made the other replacements not work 100%.)

Notice that my import did not require the full list of interface translations included in SAB to be in the text file that imported.

Now that I know all this, I can do this process relatively quickly but it certainly isn’t intuitive or well defined. At the least, it would be helpful for others to have more documentation/instruction of the Export/Import process.