Greet your website visitors in their native language!
This plugin requires Craft CMS 3 or later.
Use a personal greeting on your website with many translation options: language name, language code, country code, locale or detected from the browser of the user.
Just install the plugin through the Craft Plugin Store.
There are two ways to use the plugin, via twig functions and HTTP requests.
craft.helloTranslated.detectBrowser()
Detects the browser language and returns the appropriate translationcraft.helloTranslated.getByCountryCode('GB')
Given the 2 character ISO country code returns the appropriate translationcraft.helloTranslated.getByLanguageCode('en')
Given the 2 character ISO language code returns the appropriate translationcraft.helloTranslated.getByLanguageName('english')
Given the language name returns the appropriate translationcraft.helloTranslated.getByLocale('en_US')
Given the locale (PHP locale) returns the appropriate translation
api/helloTranslated/countryCode/<countryCode>
Given the 2 character ISO country code returns the appropriate translationapi/helloTranslated/languageCode/<languageCode>
Given the 2 character ISO language code returns the appropriate translationapi/helloTranslated/languageName/<languageName>
Given the language name returns the appropriate translationapi/helloTranslated/locale/<locale>
Given the locale (PHP locale) returns the appropriate translation
Request
GET /api/helloTranslated/languageName/Dutch
Response
{
"translations": [
"Hallo"
]
}
Request
GET /api/helloTranslated/countryCode/CH
Response
{
"translations": [
"Hallo",
"Salut",
"Ciao"
]
}
Notice: This plugin makes use of PHP locale to determine the language. That means for a multilanguage country, system will return multiple translations. e.g. In Switzerland the languages Italian, French and German are spoken. Therefore plugin will return all 3 possible translations (Hallo/Salut/Ciao).
Not every language is translated but feel free to suggest new ones and/or suggest update of the current ones! :)
Made with ❤️ by Bolden and free to use!