The problem here is that when you publish a widget into Portal its hosted outside the WAB and you run into issues with paths. Widgets/MyWidget will no longer work. I'm not 100% sure on i18n, it always seems to work differently with paths to other dojo require items. Anyway I ran into the same issue with the AddData widget so here is what I think. With the geoprocessing widget I see:
RecordSetEditorChooser.js: 26
'dojo/i18n!../nls/strings',
Here there is a path and it is failing to find it, the error message is misleading I think its actually looking for it in the WAB. There should be a way to make it work as a relative path but I'm not sure what it is. I ended up just requiring the js file relatively (so no i18n):
'./nls/strings',
then using the .root property:
RecordSetEditorChooser.js: 38
lang.mixin(this.nls, gpNls.root);
This means your localisation won't work, but at least the widget may work...
With the add data widget there were lots of data-dojo-type within the templates. Remember "widgets" no longer works as a path, this is looking in the widgets folder of the WAB, not local to your widget. To fix this I ended up removing the data-dojo-type and creating the widgets within widget.js. Hoepfully you won't have to do this and it will be the simple one line fix above (because this is a nightmare)
data-dojo-type="widgets/AddData/search/ScopeOptions"
The main point is that you have to get into the mindset that everything must work relatively if you are going to host the widget for portal
Hi, I have the exact same issue with the AddData widget. Could you possibly share your code if you managed to get it working?
Completely hacked together, but it it should work at least
Thank you very much! I am unfortunatley not able to download the zip-file from that link. Could you try share the file again? Otherwise you could send it to my email perhaps
Sorry try again. If this doesn't work drop me a PM on linked in (I don't think you can PM on geonet?
I managed to download now! Thank you for helping out!
Øystein, I realised there was an issue with the NLS if you were using the "add from file" option. updated here