From 41784d58c7f3546484d8c8945ca76f8adc665243 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Fri, 4 Mar 2016 13:57:28 +0100 Subject: [PATCH] src/system/helpers.cpp: Add function Lang2ISO639_1() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/53ef02ad2fab30764c741d3bff3f85df6060e6f6 Author: Michael Liebmann Date: 2016-03-04 (Fri, 04 Mar 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 33 +++++++++++++++++++++++++++++++++ src/system/helpers.h | 1 + 2 files changed, 34 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index de76cb728..70dd11838 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -944,3 +944,36 @@ std::string getJFFS2MountPoint(int mtdPos) fclose(fd); return ""; } + +std::string Lang2ISO639_1(std::string& lang) +{ + std::string ret = ""; + if ((lang == "deutsch") || (lang == "bayrisch") || (lang == "ch-baslerdeutsch") || (lang == "ch-berndeutsch")) + ret = "de"; + else if (lang == "english") + ret = "en"; + else if (lang == "nederlands") + ret = "nl"; + else if (lang == "slovak") + ret = "sk"; + else if (lang == "bosanski") + ret = "bs"; + else if (lang == "czech") + ret = "cs"; + else if (lang == "francais") + ret = "fr"; + else if (lang == "italiano") + ret = "it"; + else if (lang == "polski") + ret = "pl"; + else if (lang == "portugues") + ret = "pt"; + else if (lang == "russkij") + ret = "ru"; + else if (lang == "suomi") + ret = "fi"; + else if (lang == "svenska") + ret = "sv"; + + return ret; +} diff --git a/src/system/helpers.h b/src/system/helpers.h index b6da33508..486d1e8e6 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -117,5 +117,6 @@ std::vector split(const std::string &s, char delim); bool split_config_string(const std::string &str, std::map &smap); std::string getJFFS2MountPoint(int mtdPos); +std::string Lang2ISO639_1(std::string& lang); #endif