Picture of Henrik Aabom
Export source code
by Henrik Aabom - Wednesday, 8 February 2017, 3:31 PM
 

Hey fellow Adapters!

When exporting source code from the AT you get a folder structure and files that almost match what you get when you download the framework.

But not exactly the same.

For instance, the folder "node_modules" is missing completely, including all its files, which means that I can't run any Grunt commands.

Is there a way to reshape the AT-output so that I can edit it, like it was created in the framework to begin with?

 

We are trying to take a AT-created course and implement the Course Localisation feature and thought exporting the source code would do the trick. 
But with no luck so far.

I have tried copy/paste the "node_module" folder and its files into the AT-exported course, which made it possible to run “grunt build” and “grunt server” and the course runs as it should, it seems.

But running "grunt translate:export --format=csv" gives the following error:


Running "_parseSchemaFiles" task
Warning: Cannot read property 'properties' of undefined Use --force to continue.
Aborted due to warnings.

Any help, much appreciated!
Thanks

 

Picture of Jorge Castrillo
Re: Export source code
by Jorge Castrillo - Wednesday, 8 February 2017, 3:42 PM
 

Hi Henrik

When you export the course you need to run the command "npm install" with the CLI. Then you try to run grunt build, if dont work, make sure that all components are called correctly in the src/course/config.json. Sometime the plugins are called incorrectly.

In my case, i was created a new theme, when i export, in the config file my theme is called by your ID (5893a0bab523348f08249135) and the real name is "adapt-theme-001".

"build": {
"includes": [
"adapt-theme-001",
"adapt-contrib-boxMenu",
"trainin-aditional-info",
"trainin-teleport",
"adapt-contrib-pageLevelProgress",
"trainin-blockSequential",
"trainin-introvideo",
"trainin-aditional-info-component",
"adapt-contrib-narrative-invert",
"adapt-contrib-blank",
"adapt-contrib-accordion",
"adapt-contrib-mcq",
"adapt-contrib-hotgraphic",
"adapt-contrib-narrative",
"trainin-dragdrop"
]
}

 

 

Hope to help.

Picture of Henrik Aabom
Re: Export source code
by Henrik Aabom - Wednesday, 8 February 2017, 4:11 PM
 

Thanks Jorge

I think I got a little closer, but I still get the error:

Running "_parseSchemaFiles" task
Warning: Cannot read property 'properties' of undefined Use --force to continue.
Aborted due to warnings.

 

But I got around it by copying the file "course.model.schema" from the folder: "src\core\schema" of another framework-course to the same folder in my AT-course.
Now I can run the "grunt translate:export --format=csv"-command without errors and the "languagefiles"-folder is created with "en"-folder inside as it should.

But when I copy the "en"-folder, rename it to "dk", translates some text inside the csv-files and run the "grunt translate:import --targetLang=dk --masterLang=dk --replace" command, I get this error:

 

jit-grunt: Plugin for the "masterLang=dk" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings

Warning: Task "masterLang=dk" failed. Use --force to continue.

Abort due to warnings.

 

Any ideas?

 

Picture of Matt Leathes
Re: Export source code
by Matt Leathes - Wednesday, 8 February 2017, 4:34 PM
 

I think it's because you have set both the targetLang and masterLang to the same thing, try this instead:

grunt translate:import --targetLang=dk --replace

(if your masterLang is "en" you can leave this option out altogether)

Picture of Tom Taylor
Re: Export source code
by Tom Taylor - Wednesday, 8 February 2017, 4:13 PM
 

Hi Henrik,

The 'export source code' feature was implemented to do exactly as you've described, i.e. to give you the same files that you'd get if you used the framework standalone.

The node_modules folder was intentionally left out due to its size -- moving this folder around adds considerable processing time to the whole task. 

The issue around build includes Jorge describes is known. The easiest way to combat this is to remove the includes altogether. 

Have a look at the following wiki page for some more information on exporting the code: https://github.com/adaptlearning/adapt_authoring/wiki/Exporting-Course-Source-Code

Picture of Henrik Aabom
Re: Export source code
by Henrik Aabom - Thursday, 9 February 2017, 9:08 AM
 

Thanks for the reply Tom and Matt, I really apprecate the help!

When I follow the instructions on:

https://github.com/adaptlearning/adapt_authoring/wiki/Exporting-Course-Source-Code

and run npm install + remove content from the "build: {}", then I can grunt build and grunt server, just fine.

But, like before I still get an error when running: grunt translate:export --format=csv.

 

It gets to "_parseSchemaFiles" task and abourts with a warning message stating: Cannot read property 'properties' of undefined Use --force to contunie.

 

Any ideas why?

Picture of Matt Leathes
Re: Export source code
by Matt Leathes - Thursday, 9 February 2017, 10:10 AM
 

Without being able to see the exported content, my best guess - based on your description - is that there's a problem with one or more of the properties.schema files.

You said in your earlier post that you 'got around it by copying the file "course.model.schema"' from another course - I think it's probably something to do with that, let me investigate a bit further.

Picture of Henrik Aabom
Re: Export source code
by Henrik Aabom - Thursday, 9 February 2017, 10:00 AM
 

Well that's the thing... I wanted to test how to do all this, before trying to do it on a "real" course. So I've not added any extensions at all to the course, and I've only created a single page with a text component with some text I want to translate.

The theme is vanilla and menu is box-menu.

Everything should be contrib plugins.

Picture of Matt Leathes
Re: Export source code
by Matt Leathes - Thursday, 9 February 2017, 10:12 AM
 

sorry I edited my post after you'd replied...

Picture of Matt Leathes
Re: Export source code
by Matt Leathes - Thursday, 9 February 2017, 12:04 PM
 

OK so it seems that the .schema files that are in the authoring tool don't contain the translatable properties that are necessary for the language export.

Not sure why this should be, I have asked in the authoring tool chat room.

For now you should export then replace these files with the versions from https://github.com/adaptlearning/adapt_framework/tree/master/src/core/schema

Picture of Matt Leathes
Re: Export source code
by Matt Leathes - Thursday, 9 February 2017, 12:22 PM
 

In fact it looks like the AT doesn't even export the core .schema files!

Have logged a ticket at https://github.com/adaptlearning/adapt_authoring/issues/1512

Picture of Henrik Aabom
Re: Export source code
by Henrik Aabom - Thursday, 9 February 2017, 1:12 PM
 

Thanks for you detective work, Matt!

So, does that mean that it is impossible, for now, to use the Course Localisation in an AT-course, until ticket 1512 has been resolved?

Picture of Matt Leathes
Re: Export source code
by Matt Leathes - Thursday, 9 February 2017, 3:47 PM
 

not at all, it just means you'll need to add the core .schema files manually as per this post

Picture of Henrik Aabom
Re: Export source code
by Henrik Aabom - Friday, 10 February 2017, 8:31 AM
 

Ok, then maybe its me that don't know how the "grunt translate" command works, because when I run 

grunt translate:import --targetLang=de --masterLang=de --replace

I don't get any errors, but the course still opens in English and not Deutsch.

 

Am I doing it wrong?

 

Picture of Matt Leathes
Re: Export source code
by Matt Leathes - Friday, 10 February 2017, 9:49 AM
 

Well in that particular example you've got the same value for targetLang and masterLang. So essentially you're telling the grunt translate task that you're translating from German to German.

Also, the course will always open at whatever language you have set as the default in config.json. Section 6 of the wiki page on localisation explains this and what to do next.