How to compile soy templates that has getText method?

The soy templates that contains getText method for i18n support does not compile in maven build.
It does not find the reference for getText method.
How can we skip it and compile the template ?

I want it to be used for writing unit tests.

The package generated from atlas-mvn also does not contain generated js files from soy. It has only the soy templates in it.

Try to Providing custom soy functions

Hi Sanjeev

Are you adding the transformers in your atlassian-plugin.xml?

Take a look at this tutorial I wrote for Atlassian back in the day:

Particularly this bit:

<web-resource key="view-metadata" name="View metadata from AJS.params">

	<!-- transform calls to AJS.getText() inside JS files -->
	<transformation extension="js">
		<transformer key="jsI18n"/>
	</transformation>

	<!-- transform Soy templates into JS -->
	<transformation extension="soy">
		<transformer key="soyTransformer">
			<functions>com.atlassian.confluence.plugins.soy:soy-core-functions</functions>
		</transformer>
	</transformation>

	<!-- JavaScript resources -->
	<resource name="init.js" type="download" location="init.js"/>
	<resource name="template-soy.js" type="download" location="template.soy"/>
	<context>page</context>
</web-resource>

You need to transform the i18n and also the soy templates using the <transformation /> nodes in the XML file

Hope this helps :slight_smile:

Thanks @yorlov, I added a custom soy function to solve it.