I have a script called Translate.js on my SharePoint online site.
https://xxxx.sharepoint.com/sites/demo/Style%20Library/docs/Scripts/Translate.js
When I use the code below and try to include the script in my CustomAction, it just says that translate is not defined, Basic because it doesn't load my script.
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="TranslationRibbonExtension"
ScriptSrc="~SiteCollection/Style%20Library/docs/Scripts/Translate.js"
Location="CommandUI.Ribbon">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.WikiPageTab.PubPageActions.Controls._children">
<Button
Id="Ribbon.WikiPageTab.PubPageActions.TranslationButton"
Alt="Translate Page"
Sequence="100"
Command="Ribbon.WikiPageTab.PubPageActions.TranslationButton.TranslatePage"
CommandType="General"
Image16by16="/_layouts/1033/images/formatmap16x16.png" Image16by16Top="-120" Image16by16Left="-32"
Image32by32="/_layouts/1033/images/formatmap32x32.png" Image32by32Top="-192" Image32by32Left="-224"
LabelText="Translate Page"
TemplateAlias="o1"
ToolTipTitle="Translate Page"
ToolTipDescription="Translate Page"
/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="Ribbon.WikiPageTab.PubPageActions.TranslationButton.TranslatePage"
CommandAction="javascript:
translate('da', 'en', 'Hej mit navn er John Doe!');
"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
Can someone tell why ScriptSrc dont load the script?