kgv / bevy_fluent Goto Github PK
View Code? Open in Web Editor NEWBevy plugin for localization using Fluent.
License: Apache License 2.0
Bevy plugin for localization using Fluent.
License: Apache License 2.0
Maybe this is intentional, but in case it's not, see this as a friendly reminder :)
Older (before Bevy 0.12) versions of bevy_fluent supported providing a Vec of asset handles for the locale bundles.
The current (Bevy 0.12) version switched to using LoadedFolder
(new API that came with the Bevy 0.12 assets rework).
However, some platforms do not support the asset_server.load_folder
API. Notably Web/WASM and Android.
I can no longer run projects that use bevy_fluent
on these platforms.
I want to make a mobile port of my game, but it seems like it is no longer possible, because LocalizationBuilder
requires LoadedFolder
.
Can you please also support using a simple Vec of asset handles instead?
It would also have the benefit that it would allow me to organize my locale assets differently if I want, instead of requiring them to be all in a single folder.
So my game's structure might be something like this:
assets
mods
[mod_name]
data
events
localization
scripts
[mod_name]
data
events
localization
scripts
And since it might be hard to use std::fs
to scan folders on some platforms, I'd very much like it, if FluentServer
could get a load_folder()
function that would receive a language identifier (for example en-US
) and when I'll give it the path mods
it will load all localization files that are inside my mods folder and are related to the en-US localization, something like bevy's AssetServer
with its recursive load_folder()
.
I think it would require bevy_fluent
's .ron
files to have an extension other than .ron
. It might not be needed in a bevy 0.5 version if it'll happen, but it would be better in a 0.6 version probably because of this bevyengine/bevy#2292 I think
What would your thoughts about such a feature be?
Thanks again for the crate!
I've tried to look at the code for ways to replace the chosen locale
at runtime and I've noticed
that Snapshot
has an IndexMap
for the locales and their bundles.
But Snapshot
's only being loaded with one locale(and I've discussed this with the community and they agree that it's better to hold in memory only the bundle for the locale used), the default
locale that's set inside FluentSettings
.
(It should be mentioned that I haven't checked if you load all the locale assets and keep them in memory even though they are not loaded into Snapshot
)
I think that in this case, the IndexMap
can be replaced with just a struct that holds a bundle
and the locale
used.
I've also seen that you cannot replace the locale used in-game unless you init_resource
for the Snapshot
again(after replacing the locale in FluentSettings
), but that is not possible at the current version because you check that the resource wasn't already initiated in the world.
So it's currently impossible to replace the locale at runtime which I think would be really useful for your users.
would love to hear your input about these issues, thanks for the crate!
All versions has it's tags, except for 0.7.0.
Because resource assets are separate from the Bundle asset, when a resource asset is hot reloaded, it doesn't update the bundle that depends on it. This makes it a little tricky to figure out how to setup hot reloading for it.
We need a system that will watch for ResourceAsset events and then update the corresponding BundleAsset when they change.
I'm going to work on this, but I wanted to open the issue first.
Line 18 in 8c62112
Here, AssetServerExt::load_glob
is used, which was removed in 0.8.
Some example code would be nice.
Is there any reason for fields of these wrappers being pub(crate)
?
If there is, perhaps ResourceAsset::new(...)
and BundleAsset::new(...)
could still be added?
This is provided by #45 . Could you please review that and if it is good, release it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.