Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rustunit/bevy_device_lang
Cross-platform way to query device language setting
https://github.com/rustunit/bevy_device_lang
bevy cross-platform gamedev mobile
Last synced: 2 months ago
JSON representation
Cross-platform way to query device language setting
- Host: GitHub
- URL: https://github.com/rustunit/bevy_device_lang
- Owner: rustunit
- License: apache-2.0
- Created: 2024-06-08T14:02:36.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-08T07:47:57.000Z (6 months ago)
- Last Synced: 2024-09-27T07:03:35.960Z (3 months ago)
- Topics: bevy, cross-platform, gamedev, mobile
- Language: Rust
- Homepage: https://crates.io/crates/bevy_device_lang
- Size: 2.92 MB
- Stars: 13
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# bevy_device_lang
[![crates.io][sh_crates]][lk_crates]
[![docs.rs][sh_docs]][lk_docs]
[![discord][sh_discord]][lk_discord][sh_crates]: https://img.shields.io/crates/v/bevy_device_lang.svg
[lk_crates]: https://crates.io/crates/bevy_device_lang
[sh_docs]: https://img.shields.io/docsrs/bevy_device_lang
[lk_docs]: https://docs.rs/bevy_device_lang/latest/bevy_device_lang/
[sh_discord]: https://img.shields.io/discord/1176858176897953872?label=discord&color=5561E6
[lk_discord]: https://discord.gg/rQNeEnMhusProvides access device language cross-platform: iOS, Android, Web (Wasm), Windows & Linux.
Useful to support app localization in the right language.See also:
[bevy_ios_iap](https://github.com/rustunit/bevy_ios_iap), [bevy_ios_gamecenter](https://github.com/rustunit/bevy_ios_gamecenter), [bevy_ios_notifications](https://github.com/rustunit/bevy_ios_notifications), [bevy_ios_alerts](https://github.com/rustunit/bevy_ios_alerts), [bevy_ios_review](https://github.com/rustunit/bevy_ios_review) & [bevy_ios_impact](https://github.com/rustunit/bevy_ios_impact)See the crate in action in [Zoolitaire](www.zoolitaire.com):
![demo](./assets/demo.gif)
## Features
* macOS, iOS (using `[NSLocale preferredLanguage]` see [docs](https://developer.apple.com/documentation/foundation/nslocale/1415614-preferredlanguages))* Android (using `Locale.getDefault().toLanguageTag` see [docs](https://developer.android.com/reference/java/util/Locale#toLanguageTag()))
* Wasm (uses `web-sys` and `Navigator.language()` see [docs](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language))
* Windows (using `GetUserDefaultLocaleName` see [docs](https://learn.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getuserdefaultlocalename))
* Linux (using Env: `LC_ALL`, `LC_MESSAGES` or `LANG`)## Usage
Add dependency: `bevy_device_lang = "0.4"`
```rust
fn bevy_system() {
let lang : Option = bevy_device_lang::get_lang();
}
```# License
All code in this repository is dual-licensed under either:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)at your option. This means you can select the license you prefer.
## Your contributions
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.