Skip to content

OGo Docs

Sections
Personal tools
You are here: Home » Members » sasepp's Home » Localizing OGo holidays

Localizing OGo holidays

Document Actions
How to localize OpenGroupware.org holidays. This document builds on other plone docs and shows how to create new holiday classes, how to translate the holiday names, how to disable the built-in holidays and more. Tested on OGo 1.0a and 1.1.6.
* 1. Introduction
* 2. The relevant files
* 3. Script for updating the calendar files
* 4. Creating new holidaygroups
* 5. Giving human-readable names to the new holidaygroups
* 6. Defining custom holidays
* 7. Translating the holiday names
* 8. Final touches

1. Introduction

Before you rush into anything, please check out the wiki page describing OpenGroupware.org and Defaults. The Defaults system in general is not a no-brainer, so it takes some getting used to... There is also an excellent HOWTO in the OGo Documentation Plone at http://docs.opengroupware.org/Members/olivier/holidays-reloaded/. You can pretty much follow it almost without having to think yourself. There are some parts that in the HOWTO that do not work out of the box, however. There are also some other HOWTO's in the plone, but they are less refined.

These instructions apply equally to OpenGroupware 1.0 and 1.1.6.


2. The relevant files

There are four relevant files that have to be modified to fully customize calendar events:

$INSTALL_PREFIX/lib/$OGO_DIR/webui/OGoSchedulerViews.lso/Resources/Defaults.plist
$INSTALL_PREFIX/share/$OGO_DIR/Holidays.plist
$INSTALL_PREFIX/share/$OGO_DIR/translations/Finnish.lproj/LSWScheduler.strings
$INSTALL_PREFIX/share/$OGO_DIR/translations/Finnish.lproj/OGoSchedulerViews.strings

INSTALL_PREFIX refers to OpenGroupware.org install prefix, which is usually /usr, /usr/local or /opt. OGO_DIR is usually opengroupware.org-1.0 or opengroupware.org-1.1.


3) Script for updating the calendar files

As seen from above, the calendar files are scattered around the OGo directories. Therefore updating them from the command line is a pain, especially if you have to copy them to a remote system. The following script is designed to make updating less error-prone and tiresome. If you don't want to type passwords all the time, use passwordless public key with SSH.

#!/bin/bash
# Profile for OpenVZ Debian Sarge
#EDIT_DIR="."
#INSTALL_PREFIX="/usr/"
#OGO_DIR="opengroupware.org-1.1"
#SERVER="172.20.1.22"
#USER="root"

# Profile for the prodcution OpenGroupware.org
EDIT_DIR="."
INSTALL_PREFIX="/usr/local"
OGO_DIR="opengroupware.org-1.0"
SERVER="172.20.1.40"
USER="root"

echo "Server: "$SERVER
echo "User: "$USER
echo
echo "WARNING: By default I will download and upload to/from the current directory!"
echo "Press Return to continue"
read yn


if [ "$1" = "--download" ]; then
scp $USER@$SERVER:$INSTALL_PREFIX/lib/$OGO_DIR/webui/OGoSchedulerViews.lso/Resources/Defaults.plist $EDIT_DIR/OGoSchedulerViews/
scp $USER@$SERVER:$INSTALL_PREFIX/share/$OGO_DIR/Holidays.plist $EDIT_DIR/
scp $USER@$SERVER:$INSTALL_PREFIX/share/$OGO_DIR/translations/Finnish.lproj/LSWScheduler.strings $EDIT_DIR/
scp $USER@$SERVER:$INSTALL_PREFIX/share/$OGO_DIR/translations/Finnish.lproj/OGoSchedulerViews.strings $EDIT_DIR/

elif [ "$1" = "--upload" ]; then
scp $EDIT_DIR/OGoSchedulerViews/Defaults.plist $USER@$SERVER:$INSTALL_PREFIX/lib/$OGO_DIR/webui/OGoSchedulerViews.lso/Resources/
scp $EDIT_DIR/Holidays.plist $USER@$SERVER:$INSTALL_PREFIX/share/$OGO_DIR/
scp $EDIT_DIR/LSWScheduler.strings $USER@$SERVER:$INSTALL_PREFIX/share/$OGO_DIR/translations/Finnish.lproj/
scp $EDIT_DIR/OGoSchedulerViews.strings $USER@$SERVER:$INSTALL_PREFIX/share/$OGO_DIR/translations/Finnish.lproj/

else
echo "Usage: \"ogo-cal-update --download|--upload\""
exit
fi


4. Creating new holidaygroups

It not necessary to create new holidaygroups. We could just as well use the predefined holidaygroups and modify them to suit our needs. I found it easier to disable most of the predefined groups and create entirely new, customized holidaygroups to replace them.

Open the file $INSTALL_PREFIX/lib/$OGO_DIR/webui/OGoSchedulerViews.lso/Resources/Defaults.plist. Select which of the holidaygroups you want to be enabled by default - if available. In this context enabled means that a holidaygroup's checkbox in Preferences -> Calendar -> Holidays is checked by default.

// We want to have only our own custom holidays enabled by default - all other show_holiday_holidaygroup -entries
// are set to NO

scheduler_show_holiday_holidaygroup_custom_all = NO; // benutzerdefinierte
scheduler_show_holiday_holidaygroup_custom_private = NO; // Ereignisse
scheduler_show_holiday_holidaygroup_pyha = YES; // PYHÄPÄIVÄT
scheduler_show_holiday_holidaygroup_juhla = YES; // JUHLAPÄIVÄT (ei vapaa)
scheduler_show_holiday_holidaygroup_muut = YES; // MUUT ERIKOISPÄIVÄT

Next we'll create our own holidaygroups and remove unwanted holidaygroups altogether. This way unwanted holidaygroups will not show up at all in Preferences -> Calendar -> Holidays.

scheduler_holiday_groups = {

// We want to disable these, because we've defined our own groups
// holidaygroup_advent = "";
// holidaygroup_bylaw = "";

// These holidaygroups might be useful, so we'll keep them. As can be seen above,
// they are not enabled by default, even though they are accessible
holidaygroup_custom_all = "";
holidaygroup_custom_private = "";

// Here we define our new holidaygroups
holidaygroup_pyha = YES";
holidaygroup_juhla = YES;
holidaygroup_muut = "YES";
};

Comment out the entries you don't want, and then move on to scheduler_school_holidays. You'll probably want to comment all entries there, unless you really wish to define your own school holidays.

scheduler_school_holidays = {
// holidaygroup_bay = "";
// holidaygroup_ber = "";
// holidaygroup_bra = "";
// holidaygroup_bre = "";
// holidaygroup_bwb = "";
// holidaygroup_hes = "";
// holidaygroup_hh = "";
// holidaygroup_mvp = "";
// holidaygroup_nrw = "";
// holidaygroup_rpf = "";
// holidaygroup_saa = "";
// holidaygroup_sac = "";
// holidaygroup_nsa = "";
// holidaygroup_sah = "";
// holidaygroup_thu = "";
// holidaygroup_slh = "";
};


5. Giving human-readable names to the new holidaygroups

Now we'll give real names to our new holidaygroups. As we created them manually, they have no corresponding lines in the language project files. Navigate to $OGO_INSTALL_PREFIX/share/$OGO_DIR/translations/Mylanguage.lproj and open the file LSWScheduler.strings. Then create new lines for each new holidaygroup:

holidaygroup_pyha = "Pyhäpäivät"
holidaygroup_juhla = "Muut juhlapäivät"
holidaygroup_muut = "Muut";

Now the new holidaygroups will be shown with the names given here. If these lines do not exist, only the variable name is probably show, which is not too pretty.


6. Defining custom holidays

Now that we have created the new holidaygroups, it's time to define the days which belong to each holidaygroup. To do this, we'll have to edit the file $INSTALL_PREFIX/share/$OGO_DIR/Holidays.plist. The holidays are divided into those that occur on the same day every year and those whose place shifts yearly, as shown below:

scheduler_everyyear_holidays = {
"bylaw" = {
"01-01" = "newYear"; // Neujahr
"01-06" = "holyThreeKings"; // Heilige 3 Koenige
"10-03" = "germanUnityDay"; // Tag der Deutschen Einheit
"10-31" = "reformationsDay"; // Reformationstag
"11-01" = "allSaintsDay"; // Allerheiligen
"12-25" = "christmasDay"; // 1. Weihnachtsfeiertag
"12-26" = "boxingDay"; // 2. Weihnachtsfeiertag
};

"12-31" = "newYearsEve"; // Silvester

"custom_all" = {
};
pyha = {
"01-01" = "uudenvuodenpaiva";
"01-06" = "loppiainen";
"05-01" = "vappu";
"12-06" = "itsenaisyyspaiva";
"12-25" = "joulupaiva";
"12-26" = "tapaninpaiva";
};

juhla = {
"02-05" = "jlruneberginpaiva";
"04-09" = "mikaelagricolan_paiva";
"04-27" = "kansallinenveteraanipaiva";
"05-12" = "jvsnellmaninpaiva";
"10-10" = "aleksiskivenpaiva";
"11-06" = "ruotsalaisuudenpaiva";
"02-28" = "kalevalanpaiva";
"06-04" = "puolustusvoimainlippujuhlanpaiva";
"03-19" = "tasaarvonpaiva";
"10-24" = "yknpaiva";
"01-27" = "vainojenuhrienmuistopaiva";
"02-14" = "ystavanpaiva";
"03-08" = "naistenpaiva";
"04-07" = "maailmanterveyspaiva";
"06-05" = "maailmanymparistopaiva";
"07-06" = "einoleinonpaiva";
"07-27" = "unikeonpaiva";
"11-20" = "lapsenoikeuksienpaiva";
"12-10" = "ihmisoikeuksienpaiva";
"12-13" = "lucianpaiva";
"12-24" = "jouluaatto";
"12-28" = "viattomienlastenpaiva";
"12-31" = "uudenvuodenaatto";
"05-09" = "eurooppapaiva";
};

muut = {
};
};

scheduler_2007_holidays = {
pyha = {
"04-09" = "toinenpaasiaispaiva";
"06-23" = "juhannuspaiva";
"02-18" = "laskiaissunnuntai";
"04-01" = "palmusunnuntai";
"04-06" = "pitkaperjantai";
"04-08" = "paasiaispaiva";
"04-09" = "2paasiaispaiva";
"05-17" = "helatorstai";
"05-27" = "helluntaipaiva";
"09-30" = "mikkelinpaiva";
"12-02" = "1adventtisunnuntai";
"12-09" = "2adventtisunnuntai";
"12-16" = "3adventtisunnuntai";
"12-23" = "4adventtisunnuntai";
"03-25" = "marianilmestyspaiva";
"11-03" = "pyhainpaiva";
"02-04" = "kynttilanpaiva";
};
juhla = {
"11-11" = "isanpaiva";
"05-13" = "aitienpaiva";
"05-20" = "kaatuneittenmuistopaiva";
"02-20" = "laskiaistiistai";
};
muut = {
"03-18" = "eduskuntavaalit";
"03-21" = "kevatpaivantasaus";
"03-25" = "kesaaikaalkaa";
"09-23" = "syyspaivantasaus";
"10-28" = "kesaaikapaattyy";
"12-22" = "talvipaivanseisaus";
};
};


The sections are linked to the holidaygroup by their name. If you create a holidaygroup called other, you will have to write a section other into this file also.

NOTE: These are variables, not translations. Therefore you should not use any special (accented, umlaut) characters in the variable names, or you will run into trouble. The translations are defined in an another file. More on that in the next section.


7. Translating the holiday names

Although you could just "translate" the variables in Holidays.plist, it's not probably a good idea. It's better to do the translation the right way, by editing the file $INSTALL_PREFIX/share/$OGO_DIR/translations/Finnish.lproj/OGoSchedulerViews.strings. The holidays which change their place yearly need a slightly different treatment from those that are in the same place every year:

Shifting holidays are referred by variable_holidaygroup. For example, if you have a holidaygroup other and you have a day called myevent that is defined in scheduler_2007_holidays, for example, you would translate it as

myevent_other = "My translation";

Take a look below for more examples:

// scheduler_20xx_holidays
// Pyhäpäivät
toinenpaasiaispaiva_pyha = "Toinen pääsiäispäivä";
juhannuspaiva_pyha = "Juhannuspäivä";
palmusunnuntai_pyha = "Palmusunnuntai";
pitkaperjantai_pyha = "Pitkäperjantai";
paasiaispaiva_pyha = "Pääsiäispäivä";
2paasiaispaiva_pyha = "2. Pääsiäispäivä";
laskiaissunnuntai_pyha = "Laskiaissunnuntai";
helatorstai_pyha = "Helatorstai";
helluntaipaiva_pyha = "Helluntaipäivä";
mikkelinpaiva_pyha = "Mikkelinpäivä";
1adventtisunnuntai_pyha = "1. Adventtisunnuntai";
2adventtisunnuntai_pyha = "2. Adventtisunnuntai";
3adventtisunnuntai_pyha = "3. Adventtisunnuntai";
4adventtisunnuntai_pyha = "4. Adventtisunnuntai";
marianilmestyspaiva_pyha = "Marian ilmestyspäivä";
pyhainpaiva_pyha = "Pyhäinpäivä";
kynttilanpaiva_pyha = "Kynttilänpäivä";

// scheduler_20xx_holidays
// Juhlapäivät
isanpaiva_juhla = "Isänpäivä";
aitienpaiva_juhla = "Äitienpäivä";
kaatuneittenmuistopaiva_juhla = "Kaatuneittein muistopäivä";
laskiaistiistai_juhla = "Laskiaistiistai";

// scheduler_20xx_holidays
// Muut erikoispäivät
eduskuntavaalit_muut = "Eduskuntavaalit";
kesaaikaalkaa_muut = "Kesäaika alkaa";
kesaaikapaattyy_muut = "Kesäaika päättyy";
kevatpaivantasaus_muut = "Kevätpäiväntasaus";
syyspaivantasaus_muut = "Syyspäiväntasaus";
talvipaivanseisaus_muut = "Talvipäivänseisaus";


Every year holidays do not (for some reason) require the _holidaygroup after their name. Just use

myevent = "My translation";

Take a look below to get the idea:

// scheduler_everyyear_holidays
uudenvuodenpaiva = "Uudenvuodenpäivä";
loppiainen = "Loppiainen";
vappu = "Vappu";
itsenaisyyspaiva = "Itsenäisyyspäivä";
joulupaiva = "Joulupäivä";
tapaninpaiva = "Tapaninpäivä";
jlruneberginpaiva = "J.L.Runebergin päivä";
tasaarvonpaiva = "Tasa-arvon päivä";
mikaelagricolan_paiva = "Mikael Agricolan päivä";
kansallinenveteraanipaiva = "Kansallinen veteraanipäivä";
jvsnellmaninpaiva = "J.V.Snellmanin päivä";
aleksiskivenpaiva = "Aleksis Kiven päivä";
ruotsalaisuudenpaiva = "Ruotsalaisuuden päivä";
kalevalanpaiva = "Kalevalan päivä";
puolustusvoimainlippujuhlanpaiva = "Puolustusvoimain lippujuhlan päivä";
yknpaiva = "YK:n päivä";
vainojenuhrienmuistopaiva = "Vainojen uhrien muistopäivä";
ystavanpaiva = "Ystävänpäivä";
naistenpaiva = "Naistenpäivä";
maailmanterveyspaiva = "Maailman terveyspäivä";
maailmanymparistopaiva = "Maailman ympäristöpäivä";
einoleinonpaiva = "Eino Leinon päivä";
unikeonpaiva = "Unikeon päivä";
lapsenoikeuksienpaiva = "Lapsen oikeuksien päivä";
ihmisoikeuksienpaiva = "Ihmisoikeuksien päivä";
lucianpaiva = "Lucian päivä";
jouluaatto = "Jouluaatto";
viattomienlastenpaiva = "Viattomien lasten päivä";
uudenvuodenaatto = "Uudenvuoden aatto";
eurooppapaiva = "Eurooppa-päivä";

// Basic OGo strings would start from here...
// ...


8. Final touches

If you do not want to see old holidaygroup headers in Preferences -> Calendar -> Holidays, you'll have to remove some translations from the file $OGO_INSTALL_PREFIX/share/$OGO_DIR/translations/Mylanguage.lproj/LSWScheduler.strings. Find the variables shown below and set them to "":

holidayrest = ""; // "Holidays";
schoolHolidays = ""; // "School holidays";

If you did not create your translations exactly as shown above, you might need to disable some other translations instead of these. When these are disabled, you will only see a : where the translations should be. This looks a bit stupid, but in my opinion a bit less stupid than having useless strings lying around the GUI.
Created by sasepp
Last modified 2007-02-28 12:16 PM
 

Powered by Plone

This site conforms to the following standards: