Update rocket_i18n and add gettext_macros (#431)

Internationalization now uses proc-macros that generate the .pot file
automatically.
This commit is contained in:
Baptiste Gelez
2019-02-02 15:23:50 +01:00
committed by GitHub
parent 8696185d1e
commit 7eef4643c8
57 changed files with 6306 additions and 5484 deletions
+2 -2
View File
@@ -1,9 +1,9 @@
@use templates::base as base_template;
@use template_utils::*;
@(ctx: BaseContext, error_message: &str, error: Content)
@(ctx: BaseContext, error_message: String, error: Content)
@:base_template(ctx, error_message, {}, {}, {
@:base_template(ctx, error_message.clone(), {}, {}, {
@:error()
<p>@error_message</p>
})
+7 -6
View File
@@ -3,10 +3,11 @@
@(ctx: BaseContext)
@:base(ctx, "", {
<h1>@i18n!(ctx.1, "Invalid CSRF token.")</h1>
<p>@i18n!(ctx.1, r#"Something is wrong with your CSRF token.
Make sure cookies are enabled in you browser, and try reloading this page.
If you continue to see this error message, please report it."#)
</p>
@:base(ctx, i18n!(ctx.1, "Invalid CSRF token"), {
<h1>@i18n!(ctx.1, "Invalid CSRF token")</h1>
<p>
@i18n!(ctx.1,
"Something is wrong with your CSRF token. Make sure cookies are enabled in you browser, and try reloading this page. If you continue to see this error message, please report it."
)
</p>
})
+1 -1
View File
@@ -1,7 +1,7 @@
@use templates::errors::base;
@use template_utils::*;
@(ctx: BaseContext, error_message: &str)
@(ctx: BaseContext, error_message: String)
@:base(ctx, error_message, {
<h1>@i18n!(ctx.1, "You are not authorized.")</h1>
+1 -1
View File
@@ -3,7 +3,7 @@
@(ctx: BaseContext)
@:base(ctx, "Page not found", {
@:base(ctx, i18n!(ctx.1, "Page not found"), {
<h1>@i18n!(ctx.1, "We couldn't find this page.")</h1>
<p>@i18n!(ctx.1, "The link that led you here may be broken.")</p>
})
+1 -1
View File
@@ -3,7 +3,7 @@
@(ctx: BaseContext)
@:base(ctx, "Internal server error", {
@:base(ctx, i18n!(ctx.1, "Internal server error"), {
<h1>@i18n!(ctx.1, "Something broke on our side.")</h1>
<p>@i18n!(ctx.1, "Sorry about that. If you think this is a bug, please report it.")</p>
})
@@ -3,7 +3,7 @@
@(ctx: BaseContext)
@:base(ctx, "Unprocessable entity", {
@:base(ctx, "Unprocessable entity".to_string(), {
<h1>@i18n!(ctx.1, "The content you sent can't be processed.")</h1>
<p>@i18n!(ctx.1, "Maybe it was too long.")</p>
})