Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Sorting fails to sort locations in context-less messages #99

Closed
mrtryhard opened this issue Jun 22, 2024 · 0 comments
Closed

Bug: Sorting fails to sort locations in context-less messages #99

mrtryhard opened this issue Jun 22, 2024 · 0 comments
Assignees
Labels
bug Something isn't working p:u Priority: urgent

Comments

@mrtryhard
Copy link
Owner

Operating system: Windows, Mac OS, Linux
qt-ts-tools version: 0.5.0
Problem's description:
Messages that are not within a context have issues where location are not sorted correctly.

Expected behavior / output:
Location should be sorted correctly: by filename first then by lines.

Sample problematic translation file

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de">
    <message>
        <source>contextLessMessage</source>
        <location line="456" filename="ui_main.cpp" />
        <location line="312" filename="ai_main.cpp" />
        <location line="300" filename="ai_main.cpp" />
        <location line="10" filename="ui_potato_viewer.cpp" />
        <comment>An example entry for contextLessMessage</comment>
        <translation type="unfinished"></translation>
    </message>
    <context>
        <name>UiContext</name>
        <message>
            <source>Name</source>
            <location line="456" filename="ui_main.cpp" />
            <location line="10" filename="ui_potato_viewer.cpp" />
            <location line="321" filename="ui_main.cpp" />
            <location line="11" filename="ui_potato_viewer.cpp" />
            <comment>An example entry for Name</comment>
            <translation type="unfinished"></translation>
        </message>
        <message>
            <location line="10" filename="ui_potato_viewer.cpp" />
            <location line="144" filename="ui_main.cpp" />
            <source>This is just a Sample</source>
            <translation>Dies ist nur ein Beispiel</translation>
        </message>
        <message>
            <source>Practice more</source>
            <translation type="unfinished"></translation>
        </message>
    </context>
    <context>
        <name>CodeContext</name>
        <message>
            <source>I am a message in which was written in Code</source>
            <translation type="unfinished"></translation>
        </message>
    </context>
</TS>

Sample expected / correct output file

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de">
    <context>
        <name>CodeContext</name>
        <message>
            <source>I am a message in which was written in Code</source>
            <translation type="unfinished"></translation>
        </message>
    </context>
    <context>
        <name>UiContext</name>
        <message>
            <source>This is just a Sample</source>
            <translation>
                Dies ist nur ein Beispiel
            </translation>
            <location filename="ui_main.cpp" line="144"></location>
            <location filename="ui_potato_viewer.cpp" line="10"></location>
        </message>
        <message>
            <source>Name</source>
            <translation type="unfinished"></translation>
            <location filename="ui_main.cpp" line="321"></location>
            <location filename="ui_main.cpp" line="456"></location>
            <location filename="ui_potato_viewer.cpp" line="10"></location>
            <location filename="ui_potato_viewer.cpp" line="11"></location>
            <comment>An example entry for Name</comment>
        </message>
        <message>
            <source>Practice more</source>
            <translation type="unfinished"></translation>
        </message>
    </context>
    <message>
        <source>contextLessMessage</source>
        <translation type="unfinished"></translation>
        <location filename="ai_main.cpp" line="300"></location>
        <location filename="ai_main.cpp" line="312"></location>
        <location filename="ui_main.cpp" line="456"></location>
        <location filename="ui_potato_viewer.cpp" line="10"></location>
        <comment>An example entry for contextLessMessage</comment>
    </message>
</TS>
@mrtryhard mrtryhard added the bug Something isn't working label Jun 22, 2024
@mrtryhard mrtryhard added this to the 0.5.1 Improvements milestone Jun 22, 2024
@mrtryhard mrtryhard self-assigned this Jun 22, 2024
mrtryhard added a commit that referenced this issue Jun 22, 2024
* Found as part of making the command line tool more robust, see #21.
mrtryhard added a commit that referenced this issue Jun 22, 2024
fixes #99: Fix context-less messages sorting.
@mrtryhard mrtryhard added the p:u Priority: urgent label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p:u Priority: urgent
Projects
None yet
Development

No branches or pull requests

1 participant