Closed bikeshedder closed 1 year ago
I rebased this branch on the current master
branch and marked the get_lang*
methods as deprecated rather than removing them.
@bikeshedder did you still want to proceed with this?
I do prefer this implementation over the other one. It's much cleaner and makes it possible to pick the language using the regular fl!
macro without any further code changes.
Closed in favour of #100
This is an alternative implementation for #59 and is based on the code from #84.
This PR adds a single new method:
This methods allows creating a shallow copy of the
FluentLanguageLoader
which can than be used just like the original loader but with a different current language setting. That makes it possible to use thefl!
macro without any changes and is a far more elegant implementation than adding multipleget_lang*
methods as done in #84.For a future change I'd like to remove the
RwLock
and change that to a builder pattern. e.g. while building the loader you can still access the bundles in a mutable way but once the build is complete the internal language config is locked in and can't be changed anymore. That would get rid of locking primitive which is there just because of theset_use_isolating
andwith_bundles_mut
methods.This PR doesn't change the public API so it is a non-breaking change just like the other PR.