question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: add ability to pass language code to the pipe

See original GitHub issue

Currently, the translate pipe reads the language code from LocaleService which is fine as a default behavior

But with being the only available behavior This caused a limitation, where some areas in the view need to translate to certain language (language is already supported in the app) but no way to do so without changing the entire language in the app

We managed to add such feature in-house, with this syntax

"UserName" | translate : "ar"

But it will be much better to be supported in the library, to avoid duplicating the effort of modifying the pipe again after each new release

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
robisim74commented, May 24, 2016

Hello. When you add this:

    get lang(): string {

        return this.localization.languageCode;

    }

LocalizationService calls the translate pipe through Change Detection, and passes the languageCode property. If you intend to force a value to the language of the translate pipe, with pure pipes it will not work, because the pipe transform method is invoked only when Change Detection detects a change in the input parameters.

0reactions
MedAndcommented, May 24, 2016

Is it possible for the translate pipe to use the localization.languageCode by default? For example:

<span>{{‘DASHBORAD_TOTAL_TITLE’ | translate}}</span>

Would be equivalent to:

<span>{{‘DASHBORAD_TOTAL_TITLE’ | translate:localization.languageCode}}</span>

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature request] Add locale selection in settings #68 - GitHub
Since YouTube deliberately assings language based on user's location, I always get russian videos, even while search query is in pure English.
Read more >
Transforming Data Using Pipes - Angular
Some pipes require at least one parameter and allow more optional parameters, such as SlicePipe . For example, {{ slice:1:5 }} creates a...
Read more >
Language Processing Pipelines · spaCy Usage Documentation
spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more....
Read more >
Feature flags - GitLab Docs
On the left sidebar, select Deployments > Feature Flags. Edit the feature flag you want to remove. Select More actions ( ). Select...
Read more >
Language Server Protocol Specification - 3.17
A capability groups a set of language features. ... A parameter literal used in requests to pass a text document and a position...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found