Skip to content

Make implementation of current language configurable #82

Open
@bikeshedder

Description

@bikeshedder

Right now the current language is set at application level. This causes tests to fail (#48) and makes it impossible to change languages for a single thread or worker (#59).

While it is desirable to add new methods like get_lang it would also help a lot if the way the current language is determined was configurable. Therefore I'm proposing a CurrentLanguage trait which can be implemented for different ways of storing the current language:

  • StaticCurrentLanguage - sets the current language once and does not support changing it at runtime.
  • ApplicationCurrentLanguage - sets the current language for the entire application using a RwLock
  • ThreadCurrentLanguage - sets the current language for the current thread using thread_local
  • TokioCurrentLanguage - sets the current language for the current worker using tokio::task_local

That's all the possible Implementations I can think of at the moment.

This is blocked by #59 as switching the current language requires a call to load_languages which is not desired when switching the language at runtime for single thread or task.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions