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

Matching of Java translations with component discovery addons #8407

Closed
2 tasks done
surli opened this issue Dec 1, 2022 · 4 comments
Closed
2 tasks done

Matching of Java translations with component discovery addons #8407

surli opened this issue Dec 1, 2022 · 4 comments
Labels
question This is more a question for the support than an issue.

Comments

@surli
Copy link
Contributor

surli commented Dec 1, 2022

Describe the issue

I'm trying to configure the component discovery addons to match Java translations that are using ApplicationResources.properties files. I think I entered the right regular expression but Weblate seems to not find any component with it, even if I have quite a lot of them in my repository.

Here's an example of the source translation file I'm trying to match: https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties
Translations are using ApplicationResources_{{ language }}.properties such as: https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources_fr.properties

I'm using the following regex for matching translations files:

(?P<component>[^/]*)/src/main/resources/ApplicationResources_(?P<language>[^/.]*).properties

and using this for the monolingual base filename:

{{ component }}/src/main/resources/ApplicationResources.properties

I put those information when configuring the discovery addons in https://l10n.xwiki.org/projects/xwiki-platform/xwiki-core-resources/ (see screenshot for configuration of this component), so I'm expecting that it would find at least the original component, but it keeps saying that no component is found.

I already tried

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

Steps to reproduce the behavior

  1. Go to '...'
  2. Scroll down to '...'
  3. Click on '...'
  4. See error

Expected behavior

No response

Screenshots

image

Exception traceback

No response

How do you run Weblate?

PyPI module

Weblate versions

* Weblate: 4.12.1
 * Django: 3.2.4
 * siphashc: 1.3
 * translate-toolkit: 3.6.1
 * lxml: 4.6.3
 * Pillow: 9.1.0
 * bleach: 3.1.5
 * python-dateutil: 2.8.1
 * social-auth-core: 4.2.0
 * social-auth-app-django: 5.0.0
 * django-crispy-forms: 1.9.2
 * oauthlib: 3.1.0
 * django-compressor: 2.4
 * djangorestframework: 3.11.1
 * django-filter: 2.4.0
 * django-appconf: 1.0.4
 * user-agents: 2.1
 * filelock: 3.6.0
 * jellyfish: 0.8.2
 * openpyxl: 3.0.5
 * celery: 5.1.0
 * kombu: 5.1.0
 * translation-finder: 2.7
 * weblate-language-data: 2021.5
 * html2text: 2020.1.16
 * pycairo: 1.19.1
 * pygobject: 3.38.0
 * diff-match-patch: 20200713
 * requests: 2.27.1
 * django-redis: 4.12.1
 * hiredis: 1.0.1
 * sentry_sdk: 0.15.1
 * Cython: 0.29.21
 * misaka: 2.1.1
 * GitPython: 3.1.8
 * borgbackup: 1.1.13
 * pyparsing: 3.0.8
 * pyahocorasick: 1.4.2
 * python-redis-lock: 3.7.0
 * charset-normalizer: 2.0.12
 * Python: 3.7.3
 * Git: 2.20.1
 * psycopg2-binary: 2.8.6
 * phply: 1.2.5
 * ruamel.yaml: 0.16.12
 * tesserocr: 2.5.2
 * boto3: 1.22.10
 * zeep: 4.1.0
 * aeidon: 1.11
 * iniparse: 0.5
 * Mercurial: 6.1.2
 * git-review: 2.3.1
 * Redis server: 5.0.14
 * PostgreSQL server: 11.14
 * Database backends: django.db.backends.postgresql
 * Cache backends: default:RedisCache, avatar:FileBasedCache
 * Email setup: django.core.mail.backends.smtp.EmailBackend: localhost
 * OS encoding: filesystem=utf-8, default=utf-8
 * Celery: redis://localhost:6379, redis://localhost:6379, regular
 * Platform: Linux 4.19.0-20-amd64 (x86_64)

Weblate deploy checks

No response

Additional context

No response

@surli surli added the question This is more a question for the support than an issue. label Dec 1, 2022
@github-actions
Copy link

github-actions bot commented Dec 1, 2022

This issue looks more like a support question than an issue. We strive to answer these reasonably fast, but purchasing the support subscription is not only more responsible and faster for your business but also makes Weblate stronger.

In case your question is already answered, making a donation is the right way to say thank you!

@nijel
Copy link
Member

nijel commented Dec 1, 2022

You're trying to match xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources_fr.properties with (?P<component>[^/]*)/src/main/resources/ApplicationResources_(?P<language>[^/.]*).properties.

That can't work because the component part excludes / and it actually is xwiki-platform-core/xwiki-platform-oldcore. So either include the prefix in the regexp (in case it is fixed}) or allow / there: (?P<component>.*)/src/main/resources/ApplicationResources_(?P<language>[^/.]*).properties

@surli
Copy link
Contributor Author

surli commented Dec 2, 2022

Thanks for the quick answer!

So actually it's a bit more complex than that: in my case we have a Maven multi-module repository and I want to detect also translations in nested module such as xwiki-platform-core/parent/child/subchild/module-with-translation and I want module-with-translation to be the name of the my component.
I did tried to use .*/(?P<component>[^/]*)/src/main/resources/ApplicationResources_(?P<language>[^/.]*).properties but I wasn't working.
At the end I figured that I needed to also capture the whole hierarchy of module for the monolingual base filename, so I ended up with this solution which is finally working:

Matching regex:
(?P<originalHierarchy>.+/)(?P<component>[^/]*)/src/main/resources/ApplicationResources_(?P<language>[^/.]*).properties

Monolingual base filename:
{{ originalHierarchy }}{{ component }}/src/main/resources/ApplicationResources.properties

@surli surli closed this as completed Dec 2, 2022
@github-actions
Copy link

github-actions bot commented Dec 2, 2022

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.

surli added a commit to surli/weblate that referenced this issue Dec 2, 2022
Following the answer on WeblateOrg#8407 I felt like it could be useful to have another example in the discovery help for this kind of usecase.
nijel pushed a commit that referenced this issue Dec 2, 2022
Following the answer on #8407 I felt like it could be useful to have another example in the discovery help for this kind of usecase.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This is more a question for the support than an issue.
Projects
None yet
Development

No branches or pull requests

2 participants