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

Source changes are not synced as fuzzy in the monolingual po #8036

Closed
2 tasks done
nedsociety opened this issue Aug 22, 2022 · 9 comments · Fixed by #8047
Closed
2 tasks done

Source changes are not synced as fuzzy in the monolingual po #8036

nedsociety opened this issue Aug 22, 2022 · 9 comments · Fixed by #8047
Assignees
Labels
bug Something is broken.
Milestone

Comments

@nedsociety
Copy link

nedsociety commented Aug 22, 2022

Describe the issue

Our project recently had some changes in the source strings. As it uses monolingual po, Weblate recognized the changes and flagged them as Needs Editing as described here.

After that I tried to make the po files reflect the changes which Weblate had automatically made, by using the Force synchronization command. However after the push it seems the command does nothing to those entries, even if they're marked as Needs Editing.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar issues in this repository.

Steps to reproduce the behavior

The repo is located in https://github.com/ftl-mv-translation/ftl-mv-translation.

  1. Fork the repo, make a branch at commitid 39fd34cbb7b1f5d4d6039e26763d8ef428b8c2b7.
  2. Create a Weblate component for locale/data/events_lightspeed.xml/*.po on the aforementioned branch.
  3. Fast-forward the branch to commitid dcf5b36c19059ab87574158480ed996806ee4e84.
  4. After the Update command Weblate grabs the source string changes.
  5. Issue Force synchronization and Push.

Expected behavior

From https://github.com/WeblateOrg/weblate/blob/main/docs/workflows.rst:

Needs editing

Translation needs editing, this is usually the result of a source string change, fuzzy matching or translator action.
The translation is stored in the file, depending on the file format it might
be marked as needing edit (for example as it gets a fuzzy flag in the Gettext file).

After Force synchronization such entries should have been marked as #, fuzzy, as they're marked as Needs Editing in Weblate.

Screenshots

image

After Force synchronization, the entry is dumped as:

#: src-en/data/events_lightspeed.xml:637
msgid ""
"data/events_lightspeed.xml$//event[@name=\"ATLAS_MENU_NOEQUIPMENT\"]/choice[@req=\"SEC"
" SECTOR_DUSKBRINGER_UNIQUE\"]/text"
msgstr "더스크브링어 주도로 나아간다."

Notice that there's no #, fuzzy though Needs Editing is checked by Weblate.

Exception traceback

No response

How do you run Weblate?

Docker container

Weblate versions

No response

Weblate deploy checks

No response

Additional context

Checks are not available as I have no access on them. The site says the version is 4.12.1.

@nijel nijel added this to the 4.14.1 milestone Aug 22, 2022
@nijel nijel added the bug Something is broken. label Aug 22, 2022
@nijel
Copy link
Member

nijel commented Aug 23, 2022

For me, the fuzzy flag is written to the file on the force synchronization:

#: src-en/data/events_lightspeed.xml:384
#, fuzzy
msgid ""
"data/events_lightspeed.xml$//event[@name=\"ATLAS_MENU\"]/choice[@req=\"SEC "
"SECTOR_DUSKBRINGER_UNIQUE\"]/text"
msgstr "Zum Duskbringer Capitol weiterreisen."

What is intentional is that this state is not written to the file directly - most of the monolingual files do not support his, and thus Weblate doesn't attempt to write the states caused by source string change.

@nijel nijel removed this from the 4.14.1 milestone Aug 23, 2022
@nijel nijel removed the bug Something is broken. label Aug 23, 2022
@nedsociety
Copy link
Author

nedsociety commented Aug 23, 2022

Weird, here's our environment. Neither the Force sync nor the Files -> Download translation yield that entry marked fuzzy:

#: src-en/data/events_lightspeed.xml:384
msgid ""
"data/events_lightspeed.xml$//event[@name=\"ATLAS_MENU\"]/choice[@req=\"SEC "
"SECTOR_DUSKBRINGER_UNIQUE\"]/text"
msgstr "Zum Duskbringer Capitol weiterreisen."

I'm curious what made the difference here.

What is intentional is that this state is not written to the file directly - most of the monolingual files do not support his, and thus Weblate doesn't attempt to write the states caused by source string change.

Could you elaborate more? If that was the case then we would have never witnessed them being marked as fuzzy in the first place. But I've got it in my small-scale test (not that repo), and you've got it on this test run as well. Is there a specific condition whether it's enabled or not? Or is there a documentation on this behavior that I can refer to fix it accordingly?

@nijel
Copy link
Member

nijel commented Aug 23, 2022

There is no condition - the needs editing state triggered by source string change is never marked for writing out to the file. The state is kept in Weblate database only. This is because most monolingual formats do not support storing string states.

@nedsociety
Copy link
Author

nedsociety commented Aug 23, 2022

Well that's a bit confusing, contradicting both the documentation and the test results.

Anyway is there a way that we may query the state programmatically?

@nijel
Copy link
Member

nijel commented Aug 23, 2022

The states changed by Weblate are indeed not covered by the docs at all. Maybe the current behavior is wrong as well, I'm just describing how it currently behaves.

Note that I'm testing on 4.14, so it might behave slightly differently than you observe.

You can get the state using API: https://docs.weblate.org/en/latest/api.html#get--api-translations-(string-project)-(string-component)-(string-language)-units-

@nedsociety
Copy link
Author

Got it, thanks. I'll try that API as a workaround for now.

@github-actions
Copy link

The issue you have reported is now resolved. If you don’t feel it’s right, please follow its labels to get a clue for further steps.

  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

@nijel nijel self-assigned this Aug 23, 2022
@nijel nijel added the bug Something is broken. label Aug 23, 2022
@nijel nijel added this to the 4.14.1 milestone Aug 23, 2022
@nijel nijel reopened this Aug 23, 2022
nijel added a commit to nijel/weblate that referenced this issue Aug 23, 2022
We should be looking at new source as parsed from the file.

Issue WeblateOrg#8036
nijel added a commit to nijel/weblate that referenced this issue Aug 23, 2022
nijel added a commit to nijel/weblate that referenced this issue Aug 23, 2022
It is expected for formats that supports this to be in sync with
Weblate.

Fixes WeblateOrg#8036
@nijel
Copy link
Member

nijel commented Aug 23, 2022

Let's try if we can easily address this, I've drafted #8047 which should make Weblate commit these flags to the PO files.

nijel added a commit that referenced this issue Aug 23, 2022
We should be looking at new source as parsed from the file.

Issue #8036
nijel added a commit that referenced this issue Aug 23, 2022
It is expected for formats that supports this to be in sync with
Weblate.

Fixes #8036
@github-actions
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants