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.

getAvailableLangs() documentation & feature request

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[X] Feature request
[X] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Calling getAvailableLangs() returns either a string[] or something like [{ id: 'en', label: 'English' }, { id: 'es', label: 'Spanish' }]. This makes it difficult to use this method to check if a saved language is available to use within the app (when persisting language outside of the @ngneat/transloco-persist-translations).

The documentation also lacks information about this method, only stating Gets the available languages:, without giving any information on the return type(s), and how to actually use it to check if a language is available for example.

Expected behavior

First of all I expect better documentation on getAvailableLangs() than almost literally the method name with spaces.

Secondly, I would like to see a method like isAvailableLang(string), to check if a given string is included in the specified availableLangs (+ lowercase on both language abbreviations would be nice to have).

What is the motivation / use case for changing the behavior?

When using a custom way of persisting a language, it doesn’t seem right to just call setActiveLang(...) without knowing if the specified language is even an available language. To prevent all kind of errors it would be nice to have a solid way of checking the specified language.

Environment


Angular version: not applicable


Browser:
- [X] not applicable

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SansDKcommented, Dec 5, 2019

Ok that’s fine! Thanks for the update.

0reactions
itayodcommented, Dec 5, 2019

@SansDK we are waiting for https://github.com/ngneat/transloco/pull/184 to release the new version with your changes

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

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