December 2007
5 posts
Setting a language preference cookie
Once you’ve got language extensions and MultiViews working, you’ll probably want to set a cookie to record the user’s language preference. You can do this in a MT4 template like so:
<div class="lang-links"><mt:if name="page-lang" like=".en$"><a href="index.ja.html" onclick="createCookie('language','ja',365);">日本語</a> | English<mt:else>日本語 | <a...
Using content negotiation in MovableType 4
Once you’ve hacked MT4 to allow periods in slugs (filenames), you can add language suffixes in the Filename field when you make pages, eg the slug about.en will give you the page about.en.html (assuming .html is your default suffix). Now you can set $MTPageBasename (which contains the language suffix) as a variable in your MT template:
<MTSetVarBlock...
Excellent. The hate I’ve felt all these years is dimming from a bright...
– Phil, on the news that the Microsoft IE team has finally passed Acid2 in internal testing. For IE8 :-S
Allowing Content Negotiation in TextPattern 4.05...
Both CMSs strip periods from URL slugs, which makes adding a “.ja” or “.en” to the end of your filename for Apache content negotiation a bit hard. Internationalization is fun huh.
Of course this means you’re responsible for not allowing periods you don’t want in your filenames. As long as you’re using some .htaccess magic to strip filename suffixes (so the actual filename...
So anyway, congratulations to Six Apart for finally joining the open community...
– Mark Pilgrim