Integration manual


Installation

  • Stop the server
  • Download jars from plugin and add them (ametys-plugin-translationflagging-1.3.0.jar and ametys- plugin-translationflagging-resources-1 .3.0.jar) to your application's WEB-INF/lib directory. Ametys

  • Add button to open tool in file WEB-INF/params/cms-ribbon-default.xml. The button identifier is org.ametys.translationflagging.SetTranslation.
    Add it to the Page
<tab label="plugin.web:RIBBON_TABS_TAB_PAGE_LABEL" id="org.ametys.cms.page.Tab">
	<groups>
		[...]
		<group label="plugin.web:RIBBON_TABS_TAB_PAGE_GROUPS_GROUP_PAGE_LABEL" icon="">
			<large>...</large>
			<medium>
				<layout align="top" size="small" cols="2">
					[...]
					<control id="org.ametys.translationflagging.SetTranslation"/>
				</layout>
			</medium>
			<small>...</small>
		</group>
	</groups>
</tab>

 

  • Restart the server

Notifications by mail

When content is modified and validated on a page linked to other translated pages, an e-mail can be sent to contributors who have the right to modify the translated version (online editing rights on the content) and who have the right to receive e-mail alerts on the translation to inform them that a new version is available.


To activate this function, modify the workflow file for your content WEB-INF/param/workflow.xml add post-function org.ametys.plugins.translationflagging.TranslationAlertFunction for the validation action as follows:

 

<post-functions>        
	<function type="avalon">
    	<arg name="role">org.ametys.plugins.translationflagging.TranslationAlertFunction</arg>
	</function>
</post-functions>

Insert this post-function after the <results>

<action id="4" name="plugin.web:WORKFLOW_ACTION_VALIDATE">
    <restrict-to>
        <conditions type="AND">
            <condition type="avalon">
                <arg name="role">org.ametys.cms.workflow.ContentCheckRightsCondition</arg>
                <arg name="right">Workflow_Rights_Validate</arg>
            </condition>
            <condition type="avalon">
                <arg name="role">org.ametys.cms.workflow.LockCondition</arg>
            </condition>
        </conditions>
    </restrict-to>
    <pre-functions>
        <function type="avalon">
            <arg name="role">org.ametys.web.workflow.ValidateContentFunction</arg>
        </function>
    </pre-functions>
    <results>
        <unconditional-result old-status=" " status=" " step="3" />
    </results>
    <post-functions>
        <function type="avalon">
            <arg name="role">org.ametys.plugins.translationflagging.TranslationAlertFunction</arg>
        </function>
    </post-functions>
</action>

 

Graphic integration

Here's an example of code to display flags on your graphic charter according to what has been entered by the contributor, leading to the target page in the other language.

<xsl:variable name="raw-translations">
        <xsl:for-each select="/cms/page/metadata/translations/*">
            <xsl:variable name="hrefResolved" select="resolver:resolve('page', .)"/>
            <xsl:if test="$hrefResolved != ''">
                <xsl:element name="{local-name()}">
                    <xsl:value-of select="$hrefResolved"/>
                </xsl:element>
            </xsl:if>
        </xsl:for-each>
</xsl:variable>
<xsl:variable name="translations" select="exsl:node-set($raw-translations)"/>
 
 
<xsl:if test="$translations/*">
			<div class="translation">
				<a name="translation"></a>
			   	<span class="hidden-L"><i18n:text i18n:key="SKIN_TRANSLATION" i18n:catalogue="skin.{$skin}"/></span>
				<ul>
					<xsl:for-each select="$translations/*">
						<li>
							<xsl:attribute name="class">
								<xsl:if test="position() = 1"><xsl:text>first </xsl:text></xsl:if>
								<xsl:if test="position() = last()"><xsl:text>last </xsl:text></xsl:if>
								<xsl:text>translation-</xsl:text><xsl:value-of select="local-name()"/>
							</xsl:attribute>
							
	                        <a href="{.}" title="skin.{$skin}:SKIN_TRANSLATION_{local-name()}" i18n:attr="title">
	                        	<img width="14" height="11" src="{ametys:skinURL(concat('img/translation/', local-name(), '.png'))}" alt="skin.{$skin}:SKIN_TRANSLATION_{local-name()}" i18n:attr="alt"/>
	                        </a>
						</li>
					</xsl:for-each>
				</ul>
			</div>
</xsl:if>

May require this in the XSL header of your :

xmlns:resolver="org.ametys.cms.transformation.xslt.ResolveURIComponent"
xmlns:ametys="org.ametys.web.transformation.xslt.AmetysXSLTHelper"

You then need to know the i18n keys used in your charter. For example :

	<message key="SKIN_TRANSLATION">Traductions :</message>
	<message key="SKIN_TRANSLATION_fr">Voir la page en français</message>
	<message key="SKIN_TRANSLATION_en">See this page in english</message>
	<message key="SKIN_TRANSLATION_es">Ver esta página en español</message>
	<message key="SKIN_TRANSLATION_de">Diese Seite in deutsch</message>
	<message key="SKIN_TRANSLATION_it">Visualizza questa pagina in italiano</message>
	<message key="SKIN_TRANSLATION_zh">?????????</message>

You'll also need images in "resources/img/translation": fr.png, en.png, es.png, de.png, it.png, zh.png.

Back to top

Translation flagging