Blog

Gavin Pickin

December 17, 2017

Spread the word


Share your thoughts

At Ortus Solutions, we love the holidays, and we wanted to gift you a gift of developer productivity, we will share a few tips and tricks that will keep giving all year around. In this series we'll be giving you 12 ContentBox tips. Keep your eye out for other 12 tips of Christmas series on our blog, including a new one this year, 12 modules of Christmas on ForgeBox.

Day 4 - Localization updates. Thanks to the Computer Know How guys, the 3.6 release sports many i18n improvements. If your site needs multiple languages, this is very important.

Changing Site Locales

A ContentBox application depends on the ColdBox i18n module which gives you the ability to serve any content in any language, use resource bundles and use the resource utilities. However, we have now exposed the ability natively for users to change locales via the UI module using our URL of: http://site.com/__changelang/en_US. The route expects an ISO valid language code in the format of code_variant.

Note By default, visitor locale's are stored in the cookie scope. You can change this via the config/Coldbox.cfc configuration CFC.

The CBHelper object can now produce these links for you in your layouts, themes and views by leveraging the following method:

/**
 * Link to the __changeLang route, this is where the fwLocale is changed
 * @lang The iso language code
 */
function linkLanguageChange( string lang = "en_US" ) {
    return getRequestContext().buildLink( '__changeLang/' & arguments.lang );
}

Locale Content Caching

All caching strategies have now been updated to allow for locale to determine its key. This way, every visitor's language will be cacheable and performant.

Add Your Comment

Recent Entries

BoxLang 1.0.0 Beta 5 Launched

BoxLang 1.0.0 Beta 5 Launched

We are pleased to announce the release of BoxLang 1.0.0-Beta 5! This latest beta version includes improvements and essential bug fixes.

What is BoxLang?

BoxLang is a modern dynamic JVM language that can be deployed on multiple runtimes: operating system (Windows/Mac/*nix/Embedded), web server, lambda, iOS, android, web assembly, and more. BoxLang combines many features from different progr

Luis Majano
Luis Majano
July 12, 2024
Explore Into the Box 2024 on CFCast!

Explore Into the Box 2024 on CFCast!

Did you miss our unique Into the Box 2024 event? This year's conference featured notable product updates, incredible new tools, and numerous tips and tricks from industry experts. If you attended Into the Box, you can review the series on demand for free. Those who missed it can purchase the entire series for just $299 and gain full access to video recordings and live sessions. The series will be available to CFCast Paid subscribers until October 30th, 2024.

Maria Jose Herrera
Maria Jose Herrera
July 11, 2024
Rest API Workshop before Adobe CFSummit 2024!

Rest API Workshop before Adobe CFSummit 2024!

Building a REST API for the Modern Developer!

Get ready to elevate your skills at our exclusive 2-day workshop in Las Vegas, Nevada, just before the Adobe CFSummit 2024! This hands-on workshop is your gateway to mastering modern REST API development using ColdBox and other modern tools.

Maria Jose Herrera
Maria Jose Herrera
July 08, 2024