[Kde-pim] KHolidays regions

John Layt jlayt at kde.org
Wed Jun 18 00:04:48 BST 2014


On 17 June 2014 23:42, John Layt <jlayt at kde.org> wrote:

> In the end, I think I was working towards a combination of options 1
> and 3, modify the file format to cater for multiple Class and Type
> tags to allow for maximum flexibility, but also add an otherwise
> meaningless variant keyword to the file name to allow for global level
> or category files, e.g. holiday-xx-en_us-catholic.  Implementing the
> latter should be very straightforward for anyone,

Ha!  Appears I already got there a long time ago, from HolidayRegion::name():

    //Cheat on type for now,take direct from region code until API is
introduced in SC 4.6
    QStringList regionParts = regionCode().toLower().split( QLatin1Char('_') );
    if ( regionParts.count() == 3 ) {
      QString type = regionParts.at( 2 );
      // Will create lots more in 4.6
      // Religious types, just simple for now
      if ( type == QLatin1String("public") ) {
        typeName = i18nc( "Holiday type", "Public" );
      } else if ( type == QLatin1String("religious") ) {
        typeName = i18nc( "Holiday type", "Religious" );
      } else if ( type == QLatin1String("financial") ) {
        typeName = i18nc( "Holiday type", "Financial" );
      } else if ( type == QLatin1String("cultural") ) {
        typeName = i18nc( "Holiday type", "Cultural" );
      } else if ( type == QLatin1String("school") ) {
        typeName = i18nc( "Holiday type", "School" );
      } else if ( type == QLatin1String("seasons") ) {
        typeName = i18nc( "Holiday type", "Seasons" );
      } else if ( type == QLatin1String("name") ) {
        typeName = i18nc( "Holiday type", "Name Days" );
      } else if ( type == QLatin1String("personal") ) {
        typeName = i18nc( "Holiday type", "Personal" );
      } else if ( type == QLatin1String("catholic") ) {
        typeName = i18nc( "Holiday type", "Catholic" );
      } else if ( type == QLatin1String("protestant") ) {
        typeName = i18nc( "Holiday type", "Protestant" );
      } else if ( type == QLatin1String("orthodox") ) {
        typeName = i18nc( "Holiday type", "Orthodox" );
      } else if ( type == QLatin1String("jewish") ) {
        typeName = i18nc( "Holiday type", "Jewish" );
      } else if ( type == QLatin1String("islamic") ) {
        typeName = i18nc( "Holiday type", "Islamic" );
      }
    }

So yeah, we already do support splitting up the national files, and
having global files using a country code of xx, so feel free to start
submitting files for these :-)  Just to note, the file format is
holiday_$country_$language[_$variant], e.g.
"holiday_us_en-us_catholic".

Maybe I will have a look at the file format changes then...

John.
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list