This is an old revision of the document!
Lang Pack Guidelines
Language files should be encoded in UTF-8 (without BOM).
A lang pack should partially reproduce the fp directory structure, so that the contents of the decompressed archive can be safely dropped into the flatpress installation dir
Sample layout bundled with Flatpress 0.804.1 Vivace
Here's a sample coming from the en-us package which is bundled in Flatpress 0.804.1 Vivace (you can use the shell script on this page; a php script should be coming soon):
. |-- fp-interface | `-- lang | `-- en-us | |-- id | |-- lang.admin.config.php | |-- lang.admin.entry.php | |-- lang.admin.main.php | |-- lang.admin.maintain.php | |-- lang.admin.php | |-- lang.admin.plugin.php | |-- lang.admin.static.php | |-- lang.admin.themes.php | |-- lang.admin.uploader.php | |-- lang.admin.widgets.php | |-- lang.comments.php | |-- lang.conf.php | |-- lang.contact.php | `-- lang.default.php |-- fp-plugins | |-- accessibleantispam | | `-- lang | | `-- lang.en-us.php | |-- adminarea | | `-- lang | | `-- lang.en-us.php | |-- akismet | | `-- lang | | `-- lang.en-us.php | |-- archives | | `-- lang | | `-- lang.en-us.php | |-- blockparser | | `-- lang | | `-- lang.en-us.php | |-- calendar | | `-- lang | | `-- lang.en-us.php | |-- categories | | `-- lang | | `-- lang.en-us.php | |-- lastcomments | | `-- lang | | `-- lang.en-us.php | |-- lastentries | | `-- lang | | `-- lang.en-us.php | |-- lightbox | | `-- lang | | `-- lang.en-us.php | |-- prettyurls | | `-- lang | | `-- lang.en-us.php | `-- thumb | `-- lang | `-- lang.en-us.php `-- fp-setup `-- lang `-- lang.en-us.php
Shell Script
Usage: ./makelangpack LOCALE
where 'LOCALE' is the locale id of the target language (it-it, en-us, de-de… etc)
put this script in the same dir where you have flatpress/
this script will create a lang/ dir with all of the language files; the script will attempt to create a fp-lang-$LOCALE.tar.bz2 file, you can anyway zip or tar the lang/ dir on your own.
PS: I know, this code sucks :D ~~NWM
#!/bin/sh ROOT=`pwd` CURRENT=$ROOT/flatpress LANG=$1 DEST=$ROOT/lang if [ -z $LANG ]; then echo USAGE: makelangpack LANG echo Where LANG is a locale, as in en-us, it-it, de-de etc. fi rm -Rf $DEST mkdir -p $DEST/fp-interface/lang echo COPYING MAIN LANG FILES cp -Rf $CURRENT/fp-interface/lang/$LANG/ $DEST/fp-interface/lang/ echo DONE mkdir $DEST/fp-plugins/ echo COPYING PLUGIN LANG FILES for A in $CURRENT/fp-plugins/* ; do if [ -e $A/lang/ ] ; then THEFILE=`basename $A` echo $THEFILE : COPYING LANG FILE THEDIR=$DEST/fp-plugins/$THEFILE/lang/ mkdir -p $THEDIR cp $CURRENT/fp-plugins/$THEFILE/lang/lang.$LANG.php $THEDIR fi done echo echo CREATING PACKAGE tar cjf fp-lang-$LANG.tar.bz2 $DEST echo LANG files for $LANG are in $DEST
this Batch file creates a LANGPACK directory, you'll have to zip it yourself :)
@echo off setlocal ENABLEDELAYEDEXPANSION set ROOT=%CD% set CURRENT=%CD%\flatpress set LANG=%1 set DEST=%ROOT%\LANGPACK if "%LANG%"=="" GOTO USAGE if not exist %CURRENT%\index.php GOTO USAGE rmdir /s /q %DEST% > NUL mkdir %DEST%\fp-interface\lang > NUL echo COPYING MAIN LANG FILES mkdir %DEST%\fp-interface\lang\%LANG% > NUL copy %CURRENT%\fp-interface\lang\%LANG%\ %DEST%\fp-interface\lang\%LANG% > NUL echo DONE mkdir %DEST%\fp-plugins\ echo COPYING PLUGIN LANG FILES for /d %%A in (%CURRENT%\fp-plugins\*) do ( if exist %%A ( set THEFILE=%%~nxA echo !THEFILE! set THEDIR=%DEST%\fp-plugins\!THEFILE!\lang\ mkdir !THEDIR! > NUL copy %CURRENT%\fp-plugins\!THEFILE!\lang\lang.%LANG%.php !THEDIR! > NUL ) ) echo DONE GOTO EOF :USAGE echo USAGE: makelangpack LANG echo Where LANG is a locale, as in en-us, it-it, de-de, etc. :EOF