<commit_before>//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2009 <NAME> <<EMAIL>>
//

#include "MarbleLocale.h"
#include "MarbleLocale_p.h"

// Qt
#include <QtCore/QLocale>


namespace Marble
{

MarbleLocalePrivate::MarbleLocalePrivate()
    : m_distanceUnit( NoDistanceUnit ),
      m_measureSystem( Metric )
{
}

MarbleLocalePrivate::~MarbleLocalePrivate()
{
}

MarbleLocale::MarbleLocale()
    : d ( new MarbleLocalePrivate )
{
}

MarbleLocale::~MarbleLocale()
{
    delete d;
}

DistanceUnit MarbleLocale::distanceUnit() const
{
    if( d->m_distanceUnit == NoDistanceUnit ) {
        if ( d->m_measureSystem == Metric ) {
            return Meter;
        }
        else {
            return MilesFeet;
        }
    }
    else {
        return d->m_distanceUnit;
    }
}

void MarbleLocale::setDistanceUnit( DistanceUnit distanceUnit )
{
    d->m_distanceUnit = distanceUnit;
}

void MarbleLocale::setMeasureSystem( MeasureSystem measureSystem )
{
    d->m_measureSystem = measureSystem;
}

MeasureSystem MarbleLocale::measureSystem() const
{
    return d->m_measureSystem;
}

QString MarbleLocale::languageCode()
{
    const QString lang = QLocale::system().name();
    QString code;

    int index = lang.indexOf ( '_' );
    if ( index != -1 ) {
        code = lang.left ( index );
    }
    else {
        index = lang.indexOf ( '@' );
        if ( index != -1 )
            code = lang.left ( index );
        else
            code = lang;
    }

    return code;
}

}<commit_msg>Support of locale == "C" in Marble. Thanks to <NAME><commit_after>//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2009 <NAME> <<EMAIL>>
//

#include "MarbleLocale.h"
#include "MarbleLocale_p.h"

// Qt
#include <QtCore/QLocale>


namespace Marble
{

MarbleLocalePrivate::MarbleLocalePrivate()
    : m_distanceUnit( NoDistanceUnit ),
      m_measureSystem( Metric )
{
}

MarbleLocalePrivate::~MarbleLocalePrivate()
{
}

MarbleLocale::MarbleLocale()
    : d ( new MarbleLocalePrivate )
{
}

MarbleLocale::~MarbleLocale()
{
    delete d;
}

DistanceUnit MarbleLocale::distanceUnit() const
{
    if( d->m_distanceUnit == NoDistanceUnit ) {
        if ( d->m_measureSystem == Metric ) {
            return Meter;
        }
        else {
            return MilesFeet;
        }
    }
    else {
        return d->m_distanceUnit;
    }
}

void MarbleLocale::setDistanceUnit( DistanceUnit distanceUnit )
{
    d->m_distanceUnit = distanceUnit;
}

void MarbleLocale::setMeasureSystem( MeasureSystem measureSystem )
{
    d->m_measureSystem = measureSystem;
}

MeasureSystem MarbleLocale::measureSystem() const
{
    return d->m_measureSystem;
}

QString MarbleLocale::languageCode()
{
    const QString lang = QLocale::system().name();
    QString code;

    int index = lang.indexOf ( '_' );
    if ( lang == "C" ) {
        code = "en";
    }
    else if ( index != -1 ) {
        code = lang.left ( index );
    }
    else {
        index = lang.indexOf ( '@' );
        if ( index != -1 )
            code = lang.left ( index );
        else
            code = lang;
    }

    return code;
}

}
{'fraction_non_alphanumeric': 0.12195828505214369, 'fraction_numerical': 0.0034762456546929316, 'mean_word_length': 2.6006256517205424, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7453543', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1087, 'n_words': 272}