Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++
4.0 KB
Raw Blame
// Interface language runtime (UiLanguage.h) against the real catalog.
#include "veyra/ui/UiLanguage.h"

#include <QCoreApplication>
#include <cstdio>

namespace {
int failures = 0;
void expect(const QString& got, const QString& want, const char* what) {
    if (got == want) return;
    ++failures;
    std::printf("FAIL %s\n  got:  %s\n  want: %s\n", what, got.toUtf8().constData(), want.toUtf8().constData());
}
} // namespace

int main(int argc, char** argv) {
    QCoreApplication app(argc, argv);
    using namespace veyra::ui;

    expect(i18n::resolve(QStringLiteral("ja")), QStringLiteral("ja"), "explicit choice kept");
    if (!i18n::apply(QStringLiteral("en"))) { std::printf("FAIL catalog did not load\n"); return 1; }

    // Exact entry, through Qt's own translate() as qsTr()/tr() use it.
    expect(QCoreApplication::translate("Any", "导出完成"), QStringLiteral("Export finished"), "exact via translator");
    // Disambiguated entry, and the plain one beside it.
    expect(QCoreApplication::translate("Any", "关闭", "off"), QStringLiteral("Off"), "disambiguation");
    expect(QCoreApplication::translate("Any", "关闭"), QStringLiteral("Close"), "plain entry next to a disambiguated one");
    // std::format message from the engine: slots carried across.
    expect(i18n::text(QStringLiteral("主机搜索发生错误(5),详情见日志;可手填 IP。")),
           QStringLiteral("Host search hit an error (5); details in the log. You can enter the IP by hand."), "format pattern");
    // A message built from pieces joined by ";".
    expect(i18n::text(QStringLiteral("HDR 视频自动使用 HEVC Main10 编码;视频导出完成")),
           QStringLiteral("HDR video automatically uses HEVC Main10; Video export finished"), "segments");
    // A capture format label with a technical tag at the end.
    expect(i18n::text(QStringLiteral("1920 x 1080 @ 120.00 fps · NV12 · 原生 · 低延迟 [format 16]")),
           QStringLiteral("1920 x 1080 @ 120.00 fps · NV12 · Native · low latency [format 16]"), "tagged segment");
    // The presentation status (VideoPresenter) joins its pieces with " · "; each is its own entry.
    expect(i18n::text(QStringLiteral("英伟达低延迟:关 · 显示同步:自动 · 不撕裂,也不等待垂直同步(延迟最低)")),
           QStringLiteral("NVIDIA Low Latency: Off · Display sync: auto · no tearing and no VSync wait (lowest latency)"), "presentation status pieces");
    expect(i18n::text(QStringLiteral("英伟达低延迟不可用,当前使用低排队(详见日志) · 输出上限:关闭 · 垂直同步:屏幕队列 1 帧,读帧前等待刷新 · 显示同步:垂直同步")),
           QStringLiteral("NVIDIA Low Latency unavailable; using low queue depth (see the log) · Output cap: off · VSync: 1-frame display queue, waits for refresh before reading a frame · Display sync: VSync"),
           "presentation fallback status pieces");
    // The NVIDIA low latency hint names the option labels; the catalog key must match the QML text exactly.
    expect(QCoreApplication::translate("Any", "减少处理排队。高负载时建议选「开」而不是「开+增强」:增强有概率导致掉帧,还会提高 GPU 频率、增加功耗。"),
           QStringLiteral("Reduce processing queue depth. Under heavy load, choose On rather than On + Boost: Boost can drop frames, and it raises GPU clocks and power use."),
           "NVIDIA low latency heavy-load hint");
    // Unknown text and paths come back unchanged.
    expect(i18n::text(QStringLiteral("D:/视频/我的片子.mkv")), QStringLiteral("D:/视频/我的片子.mkv"), "path untouched");

    i18n::apply(QStringLiteral("zh-CN"));
    expect(QCoreApplication::translate("Any", "导出完成"), QStringLiteral("导出完成"), "source language");
    expect(i18n::text(QStringLiteral("导出完成")), QStringLiteral("导出完成"), "source language text()");

    std::printf("ui i18n tests: %d failures\n", failures);
    return failures ? 1 : 0;
}