Picture of marjorie etter
importing localized files
by marjorie etter - Monday, 9 January 2017, 6:25 PM

Has anyone encountered error messages when attempting to import a localized son file? Is there a checklist of things to check during troubleshooting? Please share.

Picture of Matt Leathes
Re: importing localized files
by Matt Leathes - Monday, 9 January 2017, 8:04 PM

Hi Marjorie

To be honest, this feature's only been around less than 2 months so we haven't really had much of a chance to draw up anything like that. Whatever knowledge we do have is held on this Wiki page..

First thing is to check that the files you are trying to import are in UTF-8 format* so that they have support for special characters (accented characters and suchlike).

Once you have done so, if you are still getting errors, post them either here or in the Adapt multilang chat room and we will do what we can to help debug.

* As per the Wiki page:

"When finished translating, save each file as utf-8 in order to accommodate special characters. This is easily done in many word processing applications. It is not possible within Microsoft® Excel. A workaround is to open the file in another program such as Notepad and save it as utf-8 from there.
Note: It is recommended to use a word processing application that provides explicit control over encoding. Without such a feature, it is difficult to know if all special characters were properly encoded. LibreOffice is one such application."

Apparently Microsoft are - finally! - in the process of updating Excel to support saving files as UTF-8 in office for Windows (source) and Mac (source).

Picture of Scott L
Re: importing localized files
by Scott L - Monday, 24 April 2017, 4:00 PM

Hi Marjorie,

Hopefully you've figured things out by now, but as a newer Adapt person I was just trying this export/import feature out myself recently (using the instructions on the Wiki page Matt mentioned), and I had also run into an error message. To me, I found it was kind of an easy mistake when trying something for the first time.

After performing the localisation export...

$ grunt translate:export --format-csv

I copied the 'en' contents to a new Spanish folder ('es/') and made a couple of simple edits to the title text in the 'course.csv' file, including a series of special Spanish characters. I did this change in Excel, saved the file and exited Excel. I thought I was being clever by re-opening the file in Notepad so that I could save it as UTF-8, per the Wiki article.

Next, I tried to import the translation...

$ grunt translate:import --targetLang=es --format=csv --replace

But this failed, resulting in:

Running "_loadLanguageFiles" task
Fatal error: Error processing CSV files.

I opened the file in Excel again and found that the previous save from Excel had actually merged column A and column B together into a new column A; the location ID and the text were now in the same cell. This is what caused the error during my attempted import, which amounts to a sort of CSV syntax error I'm guessing, where the first two items that I'd translated no longer had text fields, only the (messed up) ID fields.

All in all, this was a workflow problem on my end, using Excel, not a problem with Adapt's localisation features.

When I ran through my test again, but instead of using Excel I just used Notepad for me two edits, and saved as UTF-8, the import was a nice 'n' simple success. To visually verify, I edited 'src/course/es/config.json' to set _defaultLanguage to "es" (line 2), then did a $ grunt build and $ grunt server and saw the changes.

The Wiki article also mention the use of the free LibreOffice, which includes the Excel-like Calc application. Running through my same steps using LibreOffice's Calc, things worked well without the problems Excel caused me.

Picture of Lars Halkjær
Re: importing localized files
by Lars Halkjær - Monday, 24 April 2017, 6:14 PM

We had some troubles with Excel and the csv files, but found that Google Sheets worked like a charm.

If we need to deliver as an Excel sheet, we export this from the Google Sheet, and import the Excel sheet back into Google Sheets after translation.

Not the shortest of workflows, but it beats repairing damaged csv files by hand...

And if the translator can/will work directly in the Google Sheet, it is quite hassel-free.

As far the process back into Adapt goes, it works fine for text.

It is a bit more diffcult when it comes to language specific assets like vtt subtitle files and bitmaps with text on them which must be done by hand (or by home made grunt scripts).
There is also the problem with the AT renaming assets to non-human-readable filenames, which makes it difficult to replace the file, if the translated file has the original filename.
We currently keep the original asset file name in the asset title field, and then extract a JSON struct from the database using a script in Robomongo (a bit geeky though - the original filename somewhere in the Adapt JSON files would be nice, so you could get it from a Grunt script).

Also we have not done a full course in arabic or similar languages yet, but tests indicates so far that it works (famous last words! I will know more in a month or so).

Picture of Matt Leathes
Re: importing localized files
by Matt Leathes - Monday, 24 April 2017, 7:00 PM

It's worth mentioning here that Microsoft have said they are adding UTF-8 support to both Excel for Windows and Excel for macOS.

Picture of Jimmy Jones
Re: importing localized files
by Jimmy Jones - Thursday, 7 September 2017, 7:29 AM

Thank you, Matt Leathes, for your quick reply. It does help me a lot.

I think this is a useful translation website: Spanish to English