Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. AM / PM 「上午」和「下午」翻譯處理
Forum Updated to NodeBB v4.3 + New Features

AM / PM 「上午」和「下午」翻譯處理

Scheduled Pinned Locked Moved Chinese
5 Posts 3 Posters 8.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wwycheuk
    wrote on last edited by
    #1

    大家好

    我正要將 AM 和 PM 翻譯為「上午」和「下午」,但翻譯之後時間格式就要由 H:MM AP 改為 AP H:MM ,localization 會處理嗎?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leonlee
      wrote on last edited by
      #2

      你可以试试 "QLocale":http://doc.qt.nokia.com/latest/qlocale.html#toString-6 吗?
      @
      QLocale chineseLocale(QLocale::Chinese);
      QDateTime currentDateTime = QDateTime::currentDateTime();
      QString chineseTimeString = chineseLocale.toString(currentDateTime, QString("AP hh:mm:ss"));
      QString chineseTimeShortFormatString = chineseLocale.toString(currentDateTime, QLocale::ShortFormat);
      @

      1 Reply Last reply
      0
      • L Offline
        L Offline
        leonlee
        wrote on last edited by
        #3

        See also "QLocale::amText()":http://doc.qt.nokia.com/latest/qlocale.html#amText and "QLocale::pmText()":http://doc.qt.nokia.com/latest/qlocale.html#pmText pages.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          wwycheuk
          wrote on last edited by
          #4

          如無人反對我就會將繁體中文版 AM 和 PM 翻譯為「上午」和「下午」

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            quarryman
            wrote on last edited by
            #5

            我用楼上的建议,写了如下的示例代码:
            @
            #include <QtCore/QCoreApplication>
            #include <QtCore/QLocale>
            #include <QtCore/QDateTime>
            #include <QtCore/QTextStream>

            int main(int argc, char *argv[])
            {
            QCoreApplication a(argc, argv);

            QLocale chineseLocale(QLocale::Chinese);
            QDateTime currentDateTime = QDateTime::currentDateTime();
            QString TimeString = chineseLocale.toString(currentDateTime, QString("AP hh:mm:ss"));
            QString TimeLongFormatString = chineseLocale.toString(currentDateTime, QLocale::LongFormat);
            QString TimeShortFormatString = chineseLocale.toString(currentDateTime, QLocale::ShortFormat);
            QString TimeNarrowFormatString = chineseLocale.toString(currentDateTime, QLocale::NarrowFormat);
            QTextStream cout(stdout, QIODevice::WriteOnly);
            cout<<TimeString<<endl;
            cout<<TimeLongFormatString<<endl;
            cout<<TimeShortFormatString<<endl;
            cout<<TimeNarrowFormatString<<endl;
            cout<<chineseLocale.amText()<<endl;
            cout<<chineseLocale.pmText()<<endl;
            
            return a.exec&#40;&#41;;
            

            }
            @
            输出结果为
            PM 06:40:38
            2012年8月24日星期五 中国标准时间PM6时40分38秒
            12-8-24 PM6:40
            12-8-24 PM6:40
            上午
            下午
            诚如楼上所言,前四行中的PM(AM)翻译为下午(上午)更为合适些!
            [quote author="wwycheuk" date="1332551640"]如無人反對我就會將繁體中文版 AM 和 PM 翻譯為「上午」和「下午」[/quote]

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved