The granite.utils client library folder provides the JavaScript API. To use the API, include this client library dependency in your custom clientlibs.
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
categories="custom.clientlibs"
dependencies="[granite.utils]"/>
Localization functions use the Granite.I18n namespace.
Before you present localized strings, you need to set the locale using the Granite.I18n.setLocale function. The function requires the language code of the locale as an argument:
Granite.I18n.setLocale("fr");
To present a localized string, use the Granite.I18n.get function:
Granite.I18n.get("string to localize");