Programming/qt2026. 6. 29. 10:49

현재 사용중인 코드는 좀 다르긴한데

잘 보면 :/i18n 으로 해서 리소스 파일에서 끌어오게 되어있다.

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QTranslator myappTranslator;
    if (myappTranslator.load(QLocale::system(), u"myapp"_s, u"_"_s, u":/i18n"_s))
        app.installTranslator(&myappTranslator);

    return app.exec();
}

[링크 : https://doc.qt.io/qt-6/ko/i18n-source-translation.html]

 

그러면.. 이 경로만 바꾸어 주고 빌드 시스템에서

lrealse를 수동으로 해주면 이미지와 함께 배포하게 하면 충분히 하나로 합치지 않고 배포가 가능할 것 같긴한데..

 

빌드 디렉토리에서 i18n 으로 검색해보니 qrc 관련해서 우겨 넣는게 보인다.

$ grep -rn i18n .
grep: ./main.o: 바이너리 파일 일치함
./qrc_qmake_qmake_qm_files.cpp:3903:  // i18n
./qrc_qmake_qmake_qm_files.cpp:3963:  // :/i18n
./qrc_qmake_qmake_qm_files.cpp:3966:  // :/i18n/untitled_pt_PT.qm
./qrc_qmake_qmake_qm_files.cpp:3969:  // :/i18n/untitled_ko_KR.qm
./qrc_qmake_qmake_qm_files.cpp:3972:  // :/i18n/untitled_fr_FR.qm
./qrc_qmake_qmake_qm_files.cpp:3975:  // :/i18n/untitled_sk_SK.qm
./qrc_qmake_qmake_qm_files.cpp:3978:  // :/i18n/untitled_en_US.qm
./qrc_qmake_qmake_qm_files.cpp:3981:  // :/i18n/untitled_el_GR.qm
./qrc_qmake_qmake_qm_files.cpp:3984:  // :/i18n/untitled_ru_RU.qm
./qrc_qmake_qmake_qm_files.cpp:3987:  // :/i18n/untitled_es_ES.qm
./qmake_qmake_qm_files.qrc:2:<qresource prefix="i18n">

 

ts-files에 이름을 넣고 -qm에 생성될 파일을 넣으면되니까 어찌 되려나?

$ lrelease --help
Usage:
    lrelease [options] -project project-file
    lrelease [options] ts-files [-qm qm-file]

lrelease is part of Qt's Linguist tool chain. It can be used as a
stand-alone tool to convert XML-based translations files in the TS
format into the 'compiled' QM format used by QTranslator objects.

Passing .pro files to lrelease is deprecated.
Please use the lrelease-pro tool instead, or use qmake's lrelease.prf
feature.

Options:
    -help  Display this information and exit
    -idbased
           Use IDs instead of source strings for message keying
    -compress
           Compress the QM files
    -nounfinished
           Do not include unfinished translations
    -removeidentical
           If the translated text is the same as
           the source text, do not include the message
    -markuntranslated <prefix>
           If a message has no real translation, use the source text
           prefixed with the given string instead
    -project <filename>
           Name of a file containing the project's description in JSON format.
           Such a file may be generated from a .pro file using the lprodump tool.
    -silent
           Do not explain what is being done
    -version
           Display the version of lrelease and exit

[링크 : https://chatgpt.com/share/6a41cebb-e8bc-83ee-9207-6d9ef47ff0ca]

 

일단은.. 파일 validation을 넣고 실행하게 해야 안전할 것 같은데..

'Programming > qt' 카테고리의 다른 글

qt 동적 해상도 대응  (0) 2026.06.29
QGraphicsProxyWidget  (0) 2026.06.05
QT 다국어 언어 설정 전파  (0) 2026.06.05
QT 자식 위젯으로 생성 / 부모 위젯 연결  (0) 2026.06.05
qt QTabWidget 사용  (0) 2026.06.04
Posted by 구차니