Skip to content

Fix Tormenta20 language provider configuration and custom language support - #499

Open
Solemmbum wants to merge 1 commit into
mclemente:masterfrom
Solemmbum:Tormenta20-Fixed-Adding-Languages
Open

Solemmbum wants to merge 1 commit into
mclemente:masterfrom
Solemmbum:Tormenta20-Fixed-Adding-Languages

Conversation

@Solemmbum

Copy link
Copy Markdown

Summary

This Pull Request improves the Tormenta20 language provider integration with Polyglot, fixing issues related to language configuration, customization, and character language recognition.

The existing Tormenta20 provider already supports the system's default languages, but some language management functionality relies on generic configuration paths that do not match Tormenta20's data structure.

These changes improve compatibility while preserving the existing provider and its language definitions.

Problems Addressed

1. Incorrect Language Configuration Path

Polyglot's generic language configuration methods expect languages to be stored under a standard system configuration path.

However, Tormenta20 defines its languages in:

CONFIG.T20.idiomas

As a result, language additions and removals performed through the provider may not be correctly reflected in the system configuration.

2. Language Name Customization

The existing getLanguages() implementation primarily uses the language names defined by Tormenta20.

This can prevent customized language labels configured through Polyglot from being properly reflected in the resulting language list.

3. Custom Character Languages

Tormenta20 stores character languages in two fields:

  • system.tracos.idiomas.value
  • system.tracos.idiomas.custom

The existing provider only reads the predefined language list, ignoring languages entered in the custom field.

This can cause Polyglot to fail to recognize languages that a character should understand.

Changes Made

Updated getLanguages()

  • Prioritizes customized language labels from Polyglot settings.
  • Preserves existing default language definitions and font assignments.
  • Synchronizes language labels with CONFIG.T20.idiomas.
  • Respects the existing Replace Languages setting.

Implemented addToConfig() and removeFromConfig()

  • Overrides the generic configuration methods for Tormenta20.
  • Uses the correct CONFIG.T20.idiomas configuration object.
  • Improves compatibility with Polyglot's language management functionality.

Updated getUserLanguages()

  • Preserves support for predefined languages assigned to characters.
  • Adds support for custom languages stored in system.tracos.idiomas.custom.
  • Normalizes custom language identifiers using the existing slug convention.
  • Supports comma-separated and semicolon-separated custom language entries.

Testing

The updated Tormenta20 language provider has been manually tested on Foundry VTT V14, and the reported integration issue is resolved in the test environment.

Additional regression testing across different language configurations and module combinations may still be useful.

Compatibility and Scope

  • Changes are limited to the Tormenta20 language provider.
  • No modifications to the Tormenta20 system are required.
  • Existing Tormenta20 language definitions and font mappings are preserved.
  • No changes to other system-specific language providers are intended.

Additional Notes

This PR focuses on improving the existing Tormenta20 provider rather than introducing a separate implementation.

The goal is to maintain compatibility with the system's language data structure while supporting Polyglot's customization features.

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