Skip to content

OldTranslationProvider returns empty/single language list when force_language is set #357

@bakiburakogun

Description

@bakiburakogun

Bug Description

When force_language is set in config.php (e.g., 'force_language' => 'tr'), the OldTranslationProvider::getAvailableLanguages() method returns only the forced language instead of all languages that the AI model can translate between.

This causes the translation language dropdowns to appear empty (or with only 1 language) in any app that uses the legacy ITranslationManager API — most notably Nextcloud Talk (spreed), where clicking "Translate" on a chat message shows no language options.

Root Cause

OldTranslationProvider::getAvailableLanguages() uses $this->l10nFactory->getLanguages() to build the language pair list:

$coreL = $this->l10nFactory->getLanguages();
$languages = array_merge($coreL['commonLanguages'], $coreL['otherLanguages']);

IFactory::getLanguages() returns installed UI translation languages, not all languages the AI can translate. When force_language restricts the server to a single locale, only that one language is returned → N×(N-1) = 0 language pairs.

The newer TranslateProvider (TaskProcessing API) has the same underlying issue — it also relies on l10nFactory->getLanguages() in getInputShapeEnumValues(), but this path is used by the Assistant app which may handle it differently.

Steps to Reproduce

  1. Set 'force_language' => 'tr' in config.php
  2. Enable integration_openai with a working API endpoint
  3. Open Nextcloud Talk (spreed)
  4. Click the "⋯" (more options) menu on a message → "Translate"
  5. Source and target language dropdowns are empty

Expected Behavior

The translation provider should list all languages that the AI model can translate between, regardless of the server's force_language setting. An AI translation provider's available languages are independent of the server's UI language configuration.

Suggested Fix

Instead of relying on l10nFactory->getLanguages(), use a static/hardcoded list of common languages (similar to how the model already translates via free-text prompts and is not limited to installed locales). This list could be:

  • A comprehensive set of ISO 639 languages
  • Configurable via admin settings
  • Or fetched from a standard language registry

This would also fix the same issue in TranslateProvider::getInputShapeEnumValues().

Environment

  • Nextcloud: 33.0.2
  • integration_openai: 4.3.1
  • PHP: 8.4
  • Talk (spreed): 23.0.3
  • force_language: tr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions