This article is relevant if you are seeking to use NetSuite to generate content (html, PDFs or other) in language and / or region specific contexts.
Background
Content Renderer Engine with Locale Content Generation
To solve the client’s concerns, we extended our Content Renderer Engine application to include a complete Locale based sub system. Anyone seeking to produce flexible yet easy to maintain content understands the challenge to get content to present correctly without having a locale system. Here are the key capacities that pull it all together:
- Countries: NetSuite’s built-in country list doesn’t allow extension for additional attributes. So we supply a table of all countries with standard country code and telephone prefixes. Edit and extend as you need to.
- Locales: Others have solved the problem of different regional language dialects using international locale codes. We simply bring that concept into a locale table that allows for adaptation as needed.
- Locale Elements: We developed a database sub system within NetSuite that allows the definition of terms in a locale specific context. Think of it as a dictionary of terms expressed in multiple languages.
- Locale Template Functions: Content is developed using familiar Advanced PDF techniques; however now you can reference your dictionary of user-defined terms which then can be translated into any language. No more hard coding into templates different language content.
- Locale Formatting Functions: Not only must content be expressed in different languages, numbers and dates must also be formatted for presentation specific to a person (entity)’s locale preference.
Example Template with Locale Based Function
To help illustrate the concept, below is a basic HTML template that is driven by the locale system. The content developer thinks in terms of dictionary terms and layout. While another business user (typically the Marketing department) can work on developing the locale based content. The key here is that we supply localized based functions and you can reference made-up dictionary terms that pull locale content out of the custom database. Thus, your content is a combination of NetSuite business data (such as transaction number, item, price, shipping address) and locale content (such as the labels on an order: Name, Item, Description, Quantity in English or Nombre, Artículo, Descripción, Cantidad in Spanish).
<html><body> Modify the locale referenced to see different values: <hr/>invoice Total native reference: ${invoice.total} <hr/>invoice Total with JavaScript numberWithCommas function: ${invoice.total.numberWithCommas()} <hr/>invoice Total with Trimpath |commas modifier: ${invoice.total|commas} <hr/>invoice Total spelled out: using Trimpath |words modifier: ${invoice.total|words} <hr/>invoice Total Localed _formatCurrency function: ${_formatCurrency(invoice.total,invoice.currency.internalid)} <hr/>Formatted Date via formatDate function: ${invoice.trandate.formatDate("mm/dd/yyyy")} <hr/>Formatted Date via format function: ${new Date(invoice.trandate).format("mm/dd/yyyy")} <hr/>Formatted Date via Locale based _formatDate function: ${_formatDate(invoice.trandate,"mm/dd/yyyy")} <hr/>Formatted Date via _localiedDate function: ${_localizedDate(new Date())} <hr/>Formatted Date via localized() function: ${new Date().localized()} {var fld = "additional_information"} <hr/>Localized Text Lookup Element: ${"telephone_number".localized()} <hr/>Localized Text Lookup Element with |br modifier: ${fld.localized()|br} </body></html>
Get the Locale Based Content Renderer Engine
Genius.
Thank you Christopher. Especially coming from a professional inside NetSuite!