<commit_before>#include "ext-common.h"
#include "ext-utils.h"

#include <string>
#include <map>
#include <memory>

using std::string;

namespace {

string getWin32Locale()
{
  LCID lcid;
  char iso639[10];

  lcid = GetThreadLocale ();

  if (!GetLocaleInfo (lcid, LOCALE_SISO639LANGNAME, iso639, sizeof (iso639)))
      return "C";

  return iso639;
}

class I18NHelper {
public:
    static I18NHelper *instance();

    string getString(const string& src) const;

private:
    I18NHelper();
    static I18NHelper *singleton_;

    void initChineseDict();
    void initGermanDict();

    std::map<string, string> lang_dict_;
};


I18NHelper* I18NHelper::singleton_;

I18NHelper *I18NHelper::instance() {
    if (!singleton_) {
        singleton_ = new I18NHelper();
    }
    return singleton_;
}

void I18NHelper::initChineseDict()
{
    lang_dict_["get share link"] = "获取共享链接";
    lang_dict_["lock this file"] = "锁定该文件";
    lang_dict_["unlock this file"] = "解锁该文件";
}

void I18NHelper::initGermanDict()
{
    lang_dict_["get share link"] = "Link zu dieser Datei freigeben und";
    lang_dict_["lock this file"] = "Diese Datei sperren";
    lang_dict_["unlock this file"] = "diese Datei zu entsperren";
}

I18NHelper::I18NHelper()
{
    string locale = getWin32Locale();
    if (locale == "zh") {
        initChineseDict();
    } else if (locale == "de") {
        initGermanDict();
    }
}

string I18NHelper::getString(const string& src) const
{
    auto value = lang_dict_.find(src);
    return value != lang_dict_.end() ? value->second : src;
}

} // namespace

namespace seafile {

string getString(const string& src)
{
    string value = I18NHelper::instance()->getString(src);
    std::unique_ptr<wchar_t[]> value_w(utils::utf8ToWString(value));
    return utils::wStringToLocale(value_w.get());
}<commit_msg>Updated German translation<commit_after>#include "ext-common.h"
#include "ext-utils.h"

#include <string>
#include <map>
#include <memory>

using std::string;

namespace {

string getWin32Locale()
{
  LCID lcid;
  char iso639[10];

  lcid = GetThreadLocale ();

  if (!GetLocaleInfo (lcid, LOCALE_SISO639LANGNAME, iso639, sizeof (iso639)))
      return "C";

  return iso639;
}

class I18NHelper {
public:
    static I18NHelper *instance();

    string getString(const string& src) const;

private:
    I18NHelper();
    static I18NHelper *singleton_;

    void initChineseDict();
    void initGermanDict();

    std::map<string, string> lang_dict_;
};


I18NHelper* I18NHelper::singleton_;

I18NHelper *I18NHelper::instance() {
    if (!singleton_) {
        singleton_ = new I18NHelper();
    }
    return singleton_;
}

void I18NHelper::initChineseDict()
{
    lang_dict_["get share link"] = "获取共享链接";
    lang_dict_["lock this file"] = "锁定该文件";
    lang_dict_["unlock this file"] = "解锁该文件";
}

void I18NHelper::initGermanDict()
{
    lang_dict_["get share link"] = "Freigabelink erstellen";
    lang_dict_["lock this file"] = "Datei sperren";
    lang_dict_["unlock this file"] = "Datei entsperren";
}

I18NHelper::I18NHelper()
{
    string locale = getWin32Locale();
    if (locale == "zh") {
        initChineseDict();
    } else if (locale == "de") {
        initGermanDict();
    }
}

string I18NHelper::getString(const string& src) const
{
    auto value = lang_dict_.find(src);
    return value != lang_dict_.end() ? value->second : src;
}

} // namespace

namespace seafile {

string getString(const string& src)
{
    string value = I18NHelper::instance()->getString(src);
    std::unique_ptr<wchar_t[]> value_w(utils::utf8ToWString(value));
    return utils::wStringToLocale(value_w.get());
}
{'fraction_non_alphanumeric': 0.14183222958057395, 'fraction_numerical': 0.02869757174392936, 'mean_word_length': 4.07703081232493, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, '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': '7515028', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1286, 'n_words': 283}