Results 1 to 2 of 2

Thread: QLocale request from country language to language name from this country German (de)

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QLocale request from country language to language name from this country German (de)

    Qt Code:
    1. QTextToSpeech *tessi = new QTextToSpeech(this);
    2. QVector<QLocale> localein = tessi->availableLocales();
    3. QTextStream out(stdout);
    4. out << "QTextToSpeech availableLocales \n";
    5.  
    6. foreach (const QLocale &locale, localein ) {
    7. int nr = (int)locale.language();
    8. QString country = QLocale::countryToString(locale.country());
    9. QString name(QString("%1 (%2)")
    10. .arg(QLocale::languageToString(locale.language()))
    11. .arg(locale.bcp47Name()));
    12. QVariant localeVariant(locale);
    13. out << "Lang Found:" << nr << "-" << name;
    14. out << "\n";
    15.  
    16. }
    17. out << "end... \n";
    18. out.flush();
    To copy to clipboard, switch view to plain text mode 


    How i can get the correct name from country self & language...

    the result is :
    Lang Found:31-English (en)
    Lang Found:58-Italian (it)
    Lang Found:114-Swedish (sv)
    Lang Found:37-French (fr-CA)
    Lang Found:42-German (de) but i wand "Deutsch"
    Lang Found:48-Hebrew (he)
    ....... and other...

    to get first 3 letter from https://github.com/tesseract-ocr/langdata
    to download is data key... text key unicode qchar ecc...
    example if i have the 3 first letter German ger not corect is deu "deutsch" its here a way? or write from hand a translate...

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QLocale request from country language to language name from this country German (

    i solved whit a long long switch ...

    Qt Code:
    1. switch(id) {
    2. /* 8 - Arabic الْعَرَبيّة */
    3. case 8 : nt = QTUTF8decode("\xD8\xA7\xD9\x84\xD9\x92\xD8\xB9\xD9\x8E\xD8\xB1\xD9\x8E\xD8\xA8\xD9\x8A\xD9\x91\xD8\xA9");
    4. ctess= QStringLiteral("ara");
    5. break;
    6. /* 28 - Czech čeština */
    7. case 28 : nt = QTUTF8decode("\xC4\x8D\x65\xC5\xA1\x74\x69\x6E\x61");
    8. ctess= QStringLiteral("ces");
    9. break;
    10. /* 29 - Danish dansk */
    11. case 29 : nt = QTUTF8decode("\x64\x61\x6E\x73\x6B");
    12. ctess= QStringLiteral("dan");
    13. break;
    14. /* 42 - German deusch */
    15. case 42 : nt = QTUTF8decode("\x44\x65\x75\x73\x63\x68");
    16. ctess= QStringLiteral("deu");
    17. break;
    18. /* el - 43 - Greek - Greece ελληνική/0 \xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAE */
    19. case 43 : nt = QTUTF8decode("\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAE");
    20. ctess= QStringLiteral("null"); //// not having dir
    21. break;
    22. /* 31 - English */
    23. case 31 : nt = QTUTF8decode("\x65\x6E\x67\x6C\x69\x73\x68");
    24. ctess= QStringLiteral("eng");
    25. break;
    26. /* 111 - Spanish castellà */
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Set Language of QT in German under Ubuntu
    By cit in forum Installation and Deployment
    Replies: 5
    Last Post: 20th January 2015, 19:10
  2. QLocale not retreiving language right
    By jfjf in forum Newbie
    Replies: 2
    Last Post: 5th February 2011, 09:42
  3. Best way to display segregated map of a country
    By codeslicer in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2010, 01:06
  4. 1.3.0 - UI Language
    By Asperamanca in forum Qt Tools
    Replies: 2
    Last Post: 16th December 2009, 12:19
  5. How can I add any other language
    By ethos0714 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 22nd February 2006, 03:51

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.