I've found an answer. It involves the persistent locale, whereas I'd been trying to do it with ThreadLocale.
// Save the current locale. Locale localeSnapshot = locale; // Temporarily set the persistent locale. localizationSetter.setLocaleFromLocaleName(targetLocale.toString()); // Generate the page link. ... // Restore the current locale. localizationSetter.setLocaleFromLocaleName(localeSnapshot.toString()); On 20 Apr 2015, at 7:09 pm, Geoff Callender <geoff.callender.jumpst...@gmail.com> wrote: > I'm generating a page link with PageRenderLinkSource. No problem. Now I'd > like to generate it for a specific locale. > > I've tried using LocalizationSetter#setNonPersistentLocaleFromLocaleName > immediately before PageRenderLinkSource#createPageRenderLinkWithContext , but > it has no effect. > > The aim is to produce a PDF in a specific language with PhantomJS. PhantomJS > is run in a command, with my page URL as a parameter. Without the locale in > the URL, the page prints in the default language. > > Geoff >