gitlocalize / feedback

:mega: We love feedback :sparkles:
20 stars 8 forks source link

Incorrect sync when languages present in repo but not project #131

Open jflann opened 1 year ago

jflann commented 1 year ago

Summary

If files are added to the repository before the language is specified in the GitLocalize project, the sync will act as if those files are of the source language and must be translated.

Steps to reproduce

Start with a directory such as this, with a few english templates and two languages, fr & de. Both languages are specified in Gitlocalize when the project is created and everything works.

lang/
├─ de/
│  ├─ one.po
│  ├─ two.po
├─ fr/
│  ├─ one.po
│  ├─ two.po
├─ one.pot
├─ two.pot

Add files to the repo for a new language, es:

lang/
├─ de/
│  ├─ one.po
│  ├─ two.po
├─ fr/
│  ├─ one.po
│  ├─ two.po
├─ es/
│  ├─ one.po
│  ├─ two.po
├─ one.pot
├─ two.pot

At this point, when the project syncs it will count the new files in es/ as files that need to be translated for de/ and fr/. Instead of two files to translate per language, there will be four.

Repository URL

Repository showing bug behavior

https://gitlocalize.com/repo/8674

Identical repository showing appropriate behavior

https://gitlocalize.com/repo/8688

What is the current bug behavior?

If new, language-specific files are added to the repository before the language is specified in GitLocalize, the sync will add the new files as untranslated files for each language already added. When the language is specified, the issue does not fully resolve itself. In that case, the files disappear from the interface, but the translation status shows an excess number of files and the percentages are calculated incorrectly.

I suspect this bug also causes other problems with translation sync such as files failing to show as translated, even if they've just been 100% translated and merged into the repository.

What is the expected correct behavior?

If files are added to a folder with a known language code that is not the source language, these should be ignored as not needing translation.

The translation status should accurately reflect the files needing to be translated.

Relevant logs and/or screenshots

Status of project after bug has been triggered, showing 16 extra files in each language.

image

How it should look:

image

Possible fixes

ilyaspiridonov commented 1 year ago

@jflann it appears the list of files is identical in both projects, and it's just the file count that is off? image

Indeed, before new languages are added to the project (with respective language codes), GitLocalize has no way of knowing that the files under es/ are actually translations, so I wouldn't consider this behaviour as a bug. The file count, on the other hand, is indeed incorrect, @svasilenkov can you please take a look?

ilyaspiridonov commented 1 year ago

@svasilenkov https://gitlocalize.com/repo/8674/pt/ltext/bridges.pot -- no PT translations

svasilenkov commented 1 year ago

@svasilenkov https://gitlocalize.com/repo/8674/pt/ltext/bridges.pot -- no PT translations

@ilyaspiridonov In the translation file on GitHub all translation strings are blank.

ilyaspiridonov commented 1 year ago

Ah ok fair enough

jflann commented 1 year ago

Yes, once the language is added to the project in GitLocalize, the file list does seem to correct itself, but the counts and percentages are not updated.

You can also observe a sync issue with Korean. My forked repo is even with the upstream but you can see that the three translated Korean files are not synced in the upstream. It may be related but I wanted to keep this issue relatively focused on the counts, though the sync of translation status is arguably more of a problem. Thanks for looking into it.

ilyaspiridonov commented 1 year ago

@jflann can you give more context on the sync issue though? it looks like there are three synced files in Korean under your forked project: https://gitlocalize.com/repo/8688/ko All other KO files do not contain translations (empty msgstr in KO files)

ilyaspiridonov commented 1 year ago

@jflann Ah I see what you mean - the KO files don't seem to sync back into the upstream project, although they are in the repo: https://gitlocalize.com/repo/8674/ko/ltext/bridges.pot @svasilenkov FYI

jflann commented 1 year ago

Yes, in the gitlocalize project for the forked repo, I made sure to specify all languages when it was created. In the original project, we triggered this bug by adding the Portuguese files to the repo before adding the language to the project. Around then we started to experience issues with syncing of other files. It seems like there is not a problem with the files themselves, as they sync okay in the freshly created forked project.