-
-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Reformat code with idea tool * Pierwsza działająca wersja tłumaczeń * Działa? I dobrze, bo ma działać * Ćma szła i się potkła * Ściął śmiałek źółty rząd pąków.
- Loading branch information
Showing
44 changed files
with
2,104 additions
and
474 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# (Required) The language identifier of the language used in the | ||
# source code for gettext system, and the primary fallback language | ||
# (for which all strings must be present) when using the fluent | ||
# system. | ||
fallback_language = "en" | ||
|
||
# Use the fluent localization system. | ||
[fluent] | ||
# (Required) The path to the assets directory. | ||
# The paths inside the assets directory should be structured like so: | ||
# `assets_dir/{language}/{domain}.ftl` | ||
assets_dir = "../i18n" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use i18n_embed::{ | ||
fluent::{fluent_language_loader, FluentLanguageLoader}, | ||
DefaultLocalizer, LanguageLoader, Localizer, | ||
}; | ||
use once_cell::sync::Lazy; | ||
use rust_embed::RustEmbed; | ||
|
||
#[derive(RustEmbed)] | ||
#[folder = "../i18n/"] | ||
struct Localizations; | ||
|
||
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| { | ||
let loader: FluentLanguageLoader = fluent_language_loader!(); | ||
|
||
loader.load_fallback_language(&Localizations).expect("Error while loading fallback language"); | ||
|
||
loader | ||
}); | ||
|
||
#[macro_export] | ||
macro_rules! fl { | ||
($message_id:literal) => {{ | ||
i18n_embed_fl::fl!($crate::localizer::LANGUAGE_LOADER, $message_id) | ||
}}; | ||
|
||
($message_id:literal, $($args:expr),*) => {{ | ||
i18n_embed_fl::fl!($crate::localizer::LANGUAGE_LOADER, $message_id, $($args), *) | ||
}}; | ||
} | ||
|
||
// Get the `Localizer` to be used for localizing this library. | ||
pub fn localizer() -> Box<dyn Localizer> { | ||
Box::from(DefaultLocalizer::new(&*LANGUAGE_LOADER, &Localizations)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# (Required) The language identifier of the language used in the | ||
# source code for gettext system, and the primary fallback language | ||
# (for which all strings must be present) when using the fluent | ||
# system. | ||
fallback_language = "en" | ||
|
||
# Use the fluent localization system. | ||
[fluent] | ||
# (Required) The path to the assets directory. | ||
# The paths inside the assets directory should be structured like so: | ||
# `assets_dir/{language}/{domain}.ftl` | ||
assets_dir = "../i18n" | ||
|
Oops, something went wrong.