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.

Locale overrider support

See original GitHub issue

Feature request

Thesis

So, the idea is very simple - use context manager to temporarily override current locale for provider’s instance, just like that:

>>> from mimesis import Person
>>> from mimesis import locales

>>> person = Person(locales.EN)
>>> person.full_name()
'Ozie Melton'

>>> with locales.override(person, locales.RU):
...     person.full_name()

'Симона Богданова'

>>> person.full_name()
'Waldo Foster'

Reasoning

Sometimes we need only some data from other provider and creating an instance each time is not really good, so it’s better just override locale.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sobolevncommented, Dec 2, 2018

Agree 👍

1reaction
sobolevncommented, Nov 5, 2018

Why not? Seems like an easy feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Locale Override | Drupal.org
The Locale Override module provides a very simple user interface to store translated user interface strings as config entities.
Read more >
Locale - ArchWiki
Overriding system locale per user session. The system-wide locale can be overridden in each user session by creating or editing ...
Read more >
Is Rider overriding how the culture is being determined?
When running a dotnet app (.NET 5 on the Mac) via Rider's terminal, it appears to be overriding how the culture is determined....
Read more >
JDK 11 Supported Locales - Oracle
Language (ISO 639) Coun (ISO 3166) Script (ISO 15924) Language Tag Albanian (sq) Albania (AL) (Latn) sq‑AL Arabic (ar) Algeria (DZ) (Arab) ar‑DZ Arabic (ar) Bahrain...
Read more >
Add support for locale override for special languages · Issue #53 ...
First case is Sardinian ("sc") locale which we got fully translated for Telegram, but it cannot be used since Ubuntu does not allow...
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