Finnish language support for Movable Type

Movable Type has an option to change the language used to display dates in the public site. Unfortunately, Finnish is not supported in the current versions of MT. So, I added the language support and decided to document it, in case somebody else would also like to make the changes.

If somebody from MT staff happens to read this, I’d be grateful to have Finnish support included in the next version to avoid making these changes every time when upgrading.

Warning! Adding a language requires some knowledge of editing files. If you are uncomfortable about making changes, always take backups. Remember that I don’t take any responsibility if you break your site. (Had to say this :-).

These changes are for MT version 2.11, but they should work also with older versions.

How to add Finnish language support

Go to the directory where you installed Movable Type (eg. public_html/mt). Edit the file lib/MT/Util.pm.

In the lower middle part of the file you’ll find language entries for currently supported languages. They start with two-letter language code and contain six lines of Perl code below them.

Add lines between Polish date names and characters “);”. Below is an example what the file should look like after editing. Type in only the lines that are in bold – the rest is only to show you the proper place to add the lines.


sierpnia wrzesnia pazdziernika listopada grudnia ) ],
[ qw( AM PM ) ],
],

fi => [
[ qw(Sunnuntai Maanantai Tiistai Keskiviikko Torstai
Perjantai Lauantai) ],
[ ("Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu",
"Toukokuu", "Kes\xe4kuu", "Hein\xe4kuu", "Elokuu",
"Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu") ],
[ qw( ap ip ) ],
],

);

1;


Next, edit file tmpl/cms/cfg_prefs.tmpl. Search for word “Polish”. When you find the word, add one line of text below it:


<option value="pl"<TMPL_IF NAME=LANGUAGE_PL> selected</TMPL_IF>>Polish
<option value="fi"<TMPL_IF NAME=LANGUAGE_FI> selected</TMPL_IF>>Finnish
</select></td>


If you edited files on your PC, remember to upload the changed files to your server. Make sure that file permissions are set in the same way as before editing.

That’s it! Now go to Blog Config and Preferences to change your weblog language to Finnish. Rebuild site to see the changes.

How to add even more languages

You can add even more languages using the same method. Just use the following format for Util.pm:

xx => [
[ qw(weekdays) ],
[ qw(monthnames) ],
[ qw( am pm ) ],
],

Change xx to the language code of your language (eg. fi for Finnish). Next, type in the names of weekdays separated by space, starting from Sunday and ending to Saturday. Below them write names of months, starting from January and ending to December. Finally, change am pm to proper abbreviations for in your language.

If you need to use special characters or spaces in the names, you need to write the line a little bit differently. Instead of

[ qw(name name name) ],

type:

[ ("name", "name", "name") ],

Note how all names are surrounded by quotation marks and separated by commas.

In the file cfg_prefs.tmpl, use following format:

<option value="xx"<TMPL_IF NAME=LANGUAGE_XX> selected</TMPL_IF>>Language name

Change xx to the same language code you used in Util.pm and add the proper name for your language to the end of the file.

These two changes are enough to add a new language.

One thought on “Finnish language support for Movable Type

Leave a Reply

Your email address will not be published. Required fields are marked *