Wiki : LanguagePack
Documentation Home :: Categories :: Index :: Recent Changes :: Comments :: Search :: Help :: Login/RegisterCreating a Language Pack
A language pack is a set of files that translates from language constants like _USER_MANAGEMENT to the current user language - in this case the string "User management". If LANG is the current three letter language abbreviation (like "eng" or "dan" for english and danish) then the language files are organized in all the "pnlang/LANG" directories you find all over the PostNuke file structure.
There is one language file per module per language organised like this:
/system/MODNAME/pnlang/LANG/TYPE.php or
/modules/MODNAME/pnlang/LANG/TYPE.php
Where MODNAME = module name, LANG = language abbreviation, and TYPE = request type (typically "user", "admin" or "userapi") corresponding to the UI and API files in the module directory.
For instance:
/system/Users/pnlang/eng/user.php
/system/Users/pnlang/eng/admin.php
/system/Users/pnlang/eng/userapi.php
/system/Users/pnlang/dan/user.php
/system/Users/pnlang/dan/admin.php
/system/Users/pnlang/dan/userapi.php
At last you need a core.php language file in:
/language/LANG/core.php
This will take care of all the common language constants.
So writing a new language pack requires you to copy all the english language files into suitable LANG directories and then start editing these files.
A typical language file consists of many PHP define statements - one for each language constant. For instance:
define('_USERS_SUBMITREGISTRATION', 'Submit Registration');
define('_USERS_ADDITIONALINFO', 'Additional Information');
define('_USERS_ALLOWEMAILVIEW','Allow other users to view your e-mail address');
The complete language pack should be a zip archive zipped from the root directory. So the file structure in it should be:
/system/MODNAME/pnlang/LANG/TYPE.php or
/modules/MODNAME/pnlang/LANG/TYPE.php
/language/LANG/core.php
Other language directories
If you want to overwrite the default language files then you can use:
/config/languages/LANG/MODNAME/TYPE.php
And in addition to this the system also looks in:
/config/languages/DEFLANG/MODNAME/TYPE.php
/system/MODNAME/pnlang/DEFLANG/TYPE.php
Where DEFLANG is the default language for the website (not the user's current language). This ensures the system always have language files for everything - even if some files are missing for the current language.
Development Tips
It is rather cumbersome to manage all the language files when spread out all over the file system. Especially when you want to zip it without including all the other PostNuke files. So if you are a language pack developer and wants to create a language pack for the core and AddOn? modules you can place your files like this:
/config/LANG/system/MODNAME/pnlang/LANG/TYPE.php or
/config/LANG/modules/MODNAME/pnlang/LANG/TYPE.php
/config/LANG/language/LANG/core.php
This only works when $PNConfig['System']['development'] = 1; is set in the config/config.php file
This may seem a bit odd at first, having the LANG code twice. But in this way you can have all your language files in a self contained file structure without mixing them with other language or code files. When you are ready, you just zip the /config/LANG directory. The same goes for use with Subversion or CVS - you can manage your language files in a structure identical to the final zip structure.
