Translatable Fields on SDF Custom Objects

When creating SDF custom objects in SuiteCloud projects for SuiteCloud Development Framework (SDF) that have translatable fields, you can reference translation strings from translation collections. After the custom objects and the translation collections are deployed to an account, the NetSuite UI displays the translation for each translatable field in the account language. If a field has no translation in the account language, the default translation is displayed in the NetSuite UI.

For information about translatable fields function in a NetSuite account, see String Hierarchy and Translation String Linking.

For more information about translatable fields in SDF custom objects, see the following:

Using Translatable Fields in SDF Custom Objects

The following steps contain the high-level process for using translations in XML definitions for SDF custom objects:

  1. Identify the SDF custom object that contains the translatable fields that you intend to translate. For information about that, see Translatable Fields Supported in SDF Custom Objects.

    To create an SDF custom object from a template, see the following topics:

    To create or import or an existing SDF custom object from a NetSuite account, see the following topics:

  2. Create or import a translation collection, and then add translation strings (terms) for each SDF custom object field value that you would like to translate. For more information, see Translation Collections as XML Definitions.

  3. For the translatable fields in the SDF custom object from step 1, set the attribute translate=”T”, and then reference the term from the translation collection from step 2.

    The following is an example of the displaylabel field referencing the hotel term in the custcollection_accomodations translation collection:

                    <displaylabel translate="T">[scriptid=custcollection_accomodations.hotel]</displaylabel> 
    
                  

    For information about the translation reference format and code samples, see Translation Reference Format and Translatable Field XML Examples.

  4. Export the XLIFF file for the translation collection from step 2, and send it to your translators. For information about exporting XLIFF files, see Exporting a Translation Collection.

  5. Add XLIFF files for various languages received from the translators to the translations folder in the SuiteCloud project. For more information about SuiteCloud project folders, see SuiteCloud Project Structure and File Components.

Translatable Fields Supported in SDF Custom Objects

You can identify translatable fields that are supported in SDF custom objects by searching in the SuiteCloud Development Framework XML Reference for the following text: This field accepts references to the string custom type.

The string custom type refers to the string topic that has information about the translation collection fields. For more information about those fields, see Translation Collections as XML Definitions

Considerations For Translatable Fields

Consider the following information when using translatable fields in XML definitions:

  • A translatable field cannot reference translation strings that are not in the same SuiteCloud project.

  • Translation strings can be reused in multiple translatable fields within your SDF SuiteApp. Consider the following information when reusing translation strings for translatable fields:

    • Multiple SDF custom objects within the same SuiteApp can reference the same translation string. SDF custom objects in other SuiteApps cannot reference that same translation string.

    • Multiple fields within the same SDF custom object can reference the same translation string.

  • Setting the translation=F attribute for a translatable field signifies that the value is a literal string. For information about the translate attribute and reference format, see Translation Reference Format.

Translation Reference Format

Note:

The translation reference format requires a translation collection object. For information about using translation collections in SDF, see Translation Collections as XML Definitions.

You can translate fields by using the following format:

  • Set the field translate attribute to true, by setting translate=T.

  • For the field value, specify a reference to the translation using the following format: translationCollection.string, where: translationCollection is the name of the translation collection and string is the script id for the translation string in the specified translation collection. For example, scriptid=custcollection_accomodations.hotel is a script ID reference to the string hotel in the translation collection custcollection_accomodations.

The following example combines the two previous examples and presents them in XML format:

            <displaylabel translate="T">[scriptid=custcollection_accomodations.hotel]</displaylabel> 

          

You can provide a literal string for translatable fields by specifying translate attribute as false and providing a literal string value. For example:

            <displaylabel translate="F">Hotel</displaylabel> 

          

If the translate attribute is omitted, it is the same as specifying translate="F".

Translatable Field XML Examples

The following example is a workflow SDF custom object with a label field that contains a reference to the term approve in the translation collection custcollection_approvals:

            <workflow scriptid="customworkflow1">

    <name>My custom workflow</name>

    <recordtypes>LEAD</recordtypes>

    ...

    <workflowstates>

    ...

        <workflowstate scriptid="workflowstate_approvalpending">

            <name>State 2: Pending Approval</name>

            ...

            <workflowactions triggertype="BEFORELOAD">

                <addbuttonaction scriptid="workflowaction_approvebutton">

                ...

                <label translate="T">[scriptid=custcollection_approvals.approve]</label>

                ...

            </addbuttonaction>

            </workflowactions>

        </workflowstate>

        ...

    </workflowstates>

    ...

</workflow> 

          

The following example is a custom workflow object where:

  • The workflow name references the string opportunityname in the translation collection custcollection_opportunity.

  • The workflow state name references the string state1 in the translation collection custcollection_opportunity.

            <workflow scriptid="customworkflow_opportunity">

...

<name translate=T>[scriptid=custcollection_opportunity.opportunityname]</name>

...

    <workflowstates>

        <workflowstate scriptid="workflowstate1">

            <description></description>

            <donotexitworkflow>F</donotexitworkflow>

            <name translate=T>[scriptid=custcollection_opportunity.state1]</name>

            <positionx>243</positionx>

            <positiony>133</positiony>

            <workflowactions triggertype="ONENTRY">

                <setfieldmandatoryaction scriptid="workflowaction1">

                    <clienttriggerfields></clienttriggerfields>

                    <conditionsavedsearch></conditionsavedsearch>

                    <contexttypes></contexttypes>

                    <eventtypes></eventtypes>

                    <field>STDBODYTITLE</field>

                    <isinactive>F</isinactive>

                    <ismandatory>T</ismandatory>

                    <initcondition>

                        <formula></formula>

                        <type>VISUAL_BUILDER</type>

                    </initcondition>

                 </setfieldmandatoryaction>

            </workflowactions>

        </workflowstate>

    </workflowstates>

</workflow> 

          

The following example is a translation collection object where its own name and description fields are translated:

            <translationcollection scriptid='custcollection_accommodation'>

    <name translate="T">[scriptid=custcollection_accommodation'.accommodation]</name>

    <description translate="T">[scriptid=custcollection_accomodation.accommodation_description]</description>

    <defaultlanguage>en-US</defaultlanguage>

    <description>This Translation Collection contains terms for the Hotel customization.</description>

    <strings>

        <string scriptid='accommodation'>

            <defaulttranslation>Accommodation Translation Collection</defaulttranslation>

        </string>

    </strings>

    <strings>

        <string scriptid='accomodation_description'>

            <defaulttranslation>This translation collection is translated into multiple languages.</defaulttranslation>

        </string>

    </strings>

</translationcollection> 

          

In the preceding example, the name of the translation collection references the string accommodation and the description for the translation collection references the string accomodation_description. Both the name and description fields reference strings in the custcollection_accommodation translation collection, which is the same translation collection for those name and description fields.

Related Topics

General Notices