๐ Yew I18n
โ ๏ธ Warning: This crate has been moved to
i18nrs. Please usei18nrsinstead ofyew-i18n.
๐ Introduction
Yew I18n is a Yew component that provides internationalization (i18n) support for your web applications. It allows you to manage translations and switch between different languages seamlessly, enhancing the user experience for a global audience.
๐ค Why is this Component Useful?
This library offers several benefits to make i18n implementation in your Yew projects straightforward:
-
๐ Multi-Language Support: Easily manage translations for various languages in your application.
-
๐ Seamless Integration: Integrate i18n seamlessly into your Yew components, providing a consistent language experience.
-
๐ฌ Dynamic Language Switching: Dynamically switch between supported languages to cater to diverse user preferences.
โ๏ธ Installation
Integrating Yew I18n into your Yew project is a simple process. Follow these steps:
-
Make sure you have Yew set up in your project. If not, refer to the Yew documentation for installation instructions.
-
Install the library using your preferred package manager:
-
Start using the library to manage translations and enhance the multilingual capabilities of your application.
๐ ๏ธ Usage
Incorporating Yew I18n into your application is easy. Follow these steps:
-
Set up the i18n configuration and provider:
use crateMyComponent; use I18nProvider; use HashMap; use *; -
Use the
use_translationhook to access the i18n context in your components:// ./src/components/my_component.rs use *; use use_translation; -
Customize the language and translations based on user preferences.
๐ง Props
| Name | Type | Description | Example | Default Value |
|---|---|---|---|---|
supported_languages |
Vec<&'static str> |
List of supported languages in your application. | vec!["en", "fr", "de"] |
vec!["en"] |
translations |
HashMap<String, serde_json::Value> |
Translations for different languages. | Refer to the usage examples for translations | An empty HashMap |
๐ Examples
If you're curious about how to use it with tailwind css, you can check out the examples folder for more information.
๐ค Contribution
We welcome contributions from the community to enhance this Yew I18n component. Feel free to open issues, submit pull requests, or provide feedback. Let's collaborate to make multilingual support in Yew even more powerful!
๐ License
Yew I18n is licensed under the MIT License, allowing you to use, modify, and distribute it freely. Refer to the LICENSE file for more details.