Skip to content

Conversation

k0tran
Copy link

@k0tran k0tran commented Aug 7, 2024

So the list_translations() method uses os.listdir() without any additional params. This can yield different results on different machines:

# ...
                if any(x.endswith(".mo") for x in os.listdir(locale_dir)):
                    result.append(Locale.parse(folder))
# ...

For example:

$ python3 -python3 -c "print(__import__('os').listdir('./tests/translations'))"
['messages.pot', 'ja', 'de', 'fr'] # on my x64_64 machine
['fr', 'messages.pot', 'de', 'ja'] # on my loongarch64 machine

The documentation of list_translations() say nothing about translations ordering. So I've decided that it's error in tests hence this PR is changing them rather that list_translations() method.

@k0tran k0tran changed the title Fix patch changing list-translations() ordering in tests Fix list-translations() ordering in tests Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant