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

Feature Request: Add an Optional Parameter to Disable Functionality in directive #1516

Open
MarwanMoussa88 opened this issue Jan 14, 2025 · 1 comment

Comments

@MarwanMoussa88
Copy link

MarwanMoussa88 commented Jan 14, 2025

I'm requesting introducing an optional parameter in the ngx-translate directive (e.g., translate) to allow developers to disable translation functionality directly in the HTML template. This can be particularly useful for dynamic scenarios where translation is conditionally required for certain elements.

Use Case

  • Conditional Translation: Developers can disable translations for specific HTML elements based on runtime conditions or user preferences.
  • Dynamic Behavior: Applications that adapt to varying user settings or configurations can benefit from toggling translation functionality at the template level.
  • Specific Component Use Case: I have a component where, in some cases, I need it to display translated content, while in other cases, I want it to remain untranslated. Having a built-in directive parameter would simplify this dynamic behavior without requiring workarounds like duplicating code.

Example Usage :

ngx-translate request

Benefits

  • Provides greater flexibility and control over translation behavior in templates.
  • Reduces the need for workarounds or custom directive implementations to disable ngx-translate.
  • Enhances developer experience by integrating the functionality directly into the existing directive.

Notes

The disableTranslation parameter should default to false to maintain backward compatibility.

@CodeAndWeb
Copy link
Member

Sounds like an edge case to me, that only a few users would ever need.
Let's see if there's broader demand for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants