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

Google Translate v3 fails. Invalid resource name location #7012

Closed
2 tasks done
Frexuz opened this issue Dec 26, 2021 · 6 comments
Closed
2 tasks done

Google Translate v3 fails. Invalid resource name location #7012

Frexuz opened this issue Dec 26, 2021 · 6 comments
Labels
question This is more a question for the support than an issue.

Comments

@Frexuz
Copy link

Frexuz commented Dec 26, 2021

Describe the issue

Getting an error message when Weblate tries to translate via Google Translation v3 API

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 a language's overview, then tools -> automatic translations
  2. Make sure google is chosen as the machine service
  3. Click Apply.
    (Progress bar animates, but never finishes)

or

  1. Go to any "Needs translation" string, and the error pops up. (screenshot below)

Expected behavior

Should translate successfully

Screenshots

Screenshot 2021-12-26 at 19 15 02


Screenshot 2021-12-26 at 19 15 24

Exception traceback

celery-translate stderr | [2021-12-26 11:14:25,117: ERROR/ForkPoolWorker-1] Failure while executing task: MachineTranslationError: {'signal': <Signal: task_failure providing_args={'traceback', 'exception', 'kwargs', 'task_id', 'args', 'einfo'}>, 'sender': <@task: weblate.trans.tasks.auto_translate of weblate at 0x7f0e4fa4af70>, 'task_id': 'd76d2f1e-6b6c-47e7-8a50-c71f18c54d4f', 'args': [2, 6, 'translate', 'todo', 'mt', None, ['google-translate-api-v3'], 80], 'kwargs': {}, 'traceback': <traceback object at 0x7f0e4cd2cc00>, 'einfo': <ExceptionInfo: MachineTranslationError('InvalidArgument("Invalid \'parent\'.; Invalid resource name location. Identifier must contain only lowercase letters, digits, or hyphens.;  Resource type: location")')>}
celery-translate stderr | [2021-12-26 11:14:25,117: ERROR/379] Failure while executing task
celery-translate stderr | Traceback (most recent call last):
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/celery/app/trace.py", line 451, in trace_task
celery-translate stderr |     R = retval = fun(*args, **kwargs)
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/celery/app/trace.py", line 734, in __protected_call__
celery-translate stderr |     return self.run(*args, **kwargs)
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/celery/app/autoretry.py", line 34, in run
celery-translate stderr |     return task._orig_run(*args, **kwargs)
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/tasks.py", line 396, in auto_translate
celery-translate stderr |     auto.process_mt(engines, threshold)
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/autotranslate.py", line 181, in process_mt
celery-translate stderr |     translations = self.fetch_mt(engines, int(threshold))
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/autotranslate.py", line 166, in fetch_mt
celery-translate stderr |     translation_service.batch_translate(
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/machinery/base.py", line 402, in batch_translate
celery-translate stderr |     source, language = self.get_languages(
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/machinery/base.py", line 309, in get_languages
celery-translate stderr |     raise MachineTranslationError(repr(self.supported_languages_error))
celery-translate stderr | weblate.machinery.base.MachineTranslationError: InvalidArgument("Invalid 'parent'.; Invalid resource name location. Identifier must contain only lowercase letters, digits, or hyphens.;  Resource type: location")
celery-translate stderr | [2021-12-26 11:14:25,117: ERROR/ForkPoolWorker-1] Failure while executing task
celery-translate stderr | Traceback (most recent call last):
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/celery/app/trace.py", line 451, in trace_task
celery-translate stderr |     R = retval = fun(*args, **kwargs)
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/celery/app/trace.py", line 734, in __protected_call__
celery-translate stderr |     return self.run(*args, **kwargs)
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/celery/app/autoretry.py", line 34, in run
celery-translate stderr |     return task._orig_run(*args, **kwargs)
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/tasks.py", line 396, in auto_translate
celery-translate stderr |     auto.process_mt(engines, threshold)
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/autotranslate.py", line 181, in process_mt
celery-translate stderr |     translations = self.fetch_mt(engines, int(threshold))
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/trans/autotranslate.py", line 166, in fetch_mt
celery-translate stderr |     translation_service.batch_translate(
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/machinery/base.py", line 402, in batch_translate
celery-translate stderr |     source, language = self.get_languages(
celery-translate stderr |   File "/usr/local/lib/python3.9/dist-packages/weblate/machinery/base.py", line 309, in get_languages
celery-translate stderr |     raise MachineTranslationError(repr(self.supported_languages_error))

How do you run Weblate?

Docker container

Weblate versions

  • Weblate: 4.10
  • Django: 4.0
  • siphashc: 2.1
  • translate-toolkit: 3.5.1
  • lxml: 4.7.1
  • Pillow: 8.4.0
  • bleach: 4.1.0
  • python-dateutil: 2.8.2
  • social-auth-core: 4.1.0
  • social-auth-app-django: 5.0.0
  • django-crispy-forms: 1.13.0
  • oauthlib: 3.1.1
  • django-compressor: 3.0
  • djangorestframework: 3.13.1
  • django-filter: 21.1
  • django-appconf: 1.0.5
  • user-agents: 2.2.0
  • filelock: 3.4.0
  • setuptools: 59.6.0
  • jellyfish: 0.8.9
  • openpyxl: 3.0.9
  • celery: 5.2.1
  • kombu: 5.2.2
  • translation-finder: 2.10
  • weblate-language-data: 2021.6
  • html2text: 2020.1.16
  • pycairo: 1.16.2
  • pygobject: 3.38.0
  • diff-match-patch: 20200713
  • requests: 2.26.0
  • django-redis: 5.1.0
  • hiredis: 2.0.0
  • sentry_sdk: 1.5.1
  • Cython: 0.29.26
  • misaka: 2.1.1
  • GitPython: 3.1.24
  • borgbackup: 1.1.17
  • pyparsing: 3.0.6
  • pyahocorasick: 1.4.2
  • python-redis-lock: 3.7.0
  • Python: 3.9.2
  • Git: 2.30.2
  • psycopg2: 2.9.2
  • psycopg2-binary: 2.9.2
  • phply: 1.2.5
  • chardet: 4.0.0
  • ruamel.yaml: 0.17.17
  • tesserocr: 2.5.2
  • akismet: 1.1
  • boto3: 1.20.24
  • zeep: 4.1.0
  • aeidon: 1.10.1
  • iniparse: 0.5
  • mysqlclient: 2.1.0
  • Mercurial: 6.0
  • git-svn: 2.30.2
  • git-review: 2.1.0
  • Redis server: 6.2.6
  • PostgreSQL server: 13.5
  • Database backends: django.db.backends.postgresql
  • Cache backends: default:RedisCache, avatar:FileBasedCache
  • Email setup: django.core.mail.backends.smtp.EmailBackend: smtp.example.com
  • OS encoding: filesystem=utf-8, default=utf-8
  • Celery: redis://cache:6379/1, redis://cache:6379/1, regular
  • Platform: Linux 5.4.0-90-generic (x86_64)

Weblate deploy checks

Shouldn't be related (Still setting up emails):

CRITICALS:
?: (weblate.E003) Cannot send e-mail ([Errno -2] Name or service not known), please check EMAIL_* settings.
	HINT: https://docs.weblate.org/en/weblate-4.10/admin/install.html#out-mail
?: (weblate.E012) The server e-mail address should be changed from its default value
	HINT: https://docs.weblate.org/en/weblate-4.10/admin/install.html#production-email
?: (weblate.E013) The "From" e-mail address should be changed from its default value
	HINT: https://docs.weblate.org/en/weblate-4.10/admin/install.html#production-email

INFOS:
?: (weblate.I021) Error collection is not set up, it is highly recommended for production use
	HINT: https://docs.weblate.org/en/weblate-4.10/admin/install.html#collecting-errors
?: (weblate.I028) Backups are not configured, it is highly recommended for production use
	HINT: https://docs.weblate.org/en/weblate-4.10/admin/backup.html
?: (weblate.I031) New Weblate version is available, please upgrade to 4.10.1.
	HINT: https://docs.weblate.org/en/weblate-4.10/admin/upgrade.html

Additional context

No response

@nijel
Copy link
Member

nijel commented Dec 27, 2021

Is your MT_GOOGLE_LOCATION correct?

@nijel nijel added the question This is more a question for the support than an issue. label Dec 27, 2021
@github-actions
Copy link

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!

@Frexuz
Copy link
Author

Frexuz commented Dec 27, 2021

Well, I'm not a Docker expert, and there's nothing in the docs saying how to make a file available (just setting a path gets u a permission denied error)

This is my config. It got rid of the permissions error, so i'm guessing it works 🤷

root@frexity-weblate:~# ls
gcp  snap  weblate-docker

root@frexity-weblate:~# cd weblate-docker/
root@frexity-weblate:~/weblate-docker# cat docker-compose-https.yml
version: "3"
services:
  weblate:
    image: weblate/weblate
    volumes:
      - weblate-data:/app/data
      - /root/gcp:/app/gcp <------------- ?
    env_file:
      - ./environment
    restart: always
    depends_on:
      - database
      - cache
    environment:
      WEBLATE_ENABLE_HTTPS: 1
      WEBLATE_IP_PROXY_HEADER: HTTP_X_FORWARDED_FOR
  database:
    image: postgres:13-alpine
    env_file:
      - ./environment
    volumes:
      - postgres-data:/var/lib/postgresql/data
    restart: always
  cache:
    image: redis:6-alpine
    restart: always
    command: ["redis-server", "--appendonly", "yes"]
    volumes:
      - redis-data:/data
  https-portal:
    image: steveltn/https-portal:1
    ports:
      - 80:80
      - 443:443
    restart: always
    environment:
      STAGE: production
      PROXY_READ_TIMEOUT: 3600
      CLIENT_MAX_BODY_SIZE: 100M
    volumes:
      - ssl-certs:/var/lib/https-portal
volumes:
  weblate-data: {}
  postgres-data: {}
  redis-data: {}
  ssl-certs: {}
root@frexity-weblate:~/weblate-docker# cat docker-compose-https.override.yml
version: '3'
services:
  weblate:
    environment:
      WEBLATE_DEBUG: 0
      WEBLATE_EMAIL_HOST: smtp.example.com
      WEBLATE_EMAIL_HOST_USER: user
      WEBLATE_EMAIL_HOST_PASSWORD: pass
      WEBLATE_SERVER_EMAIL: weblate@example.com
      WEBLATE_DEFAULT_FROM_EMAIL: weblate@example.com
      WEBLATE_SITE_DOMAIN: translate.frexity.com
      WEBLATE_ADMIN_PASSWORD: f2UKtDs5FW6dm5fydzraBXKQ
      WEBLATE_ADMIN_EMAIL: frexuz@frexuz.com
      WEBLATE_MT_GOOGLE_CREDENTIALS: /app/gcp/episodecalendar-336309-a16ad87fa534.json  <------------- ?
      WEBLATE_MT_GOOGLE_PROJECT: episodecalendar-336309
  https-portal:
    environment:
      DOMAINS: 'translate.frexity.com -> http://weblate:8080'
root@frexity-weblate:~/weblate-docker# ls /root/gcp/
episodecalendar-336309-a16ad87fa534.json

@nijel
Copy link
Member

nijel commented Dec 28, 2021

You don't have WEBLATE_MT_GOOGLE_LOCATION set...

@nijel nijel closed this as completed in 8e1f82f Dec 28, 2021
@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.

@Frexuz
Copy link
Author

Frexuz commented Dec 28, 2021

The docs say:

API v3 Google Cloud App Engine may be specific to a location. Change accordingly if the default global fallback does not work for you.

So I was thinking it would use the global?

Update: Saw your commit, thx :) I also tried setting it specifically. It works now <3

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