diff --git a/Cargo.lock b/Cargo.lock index da4c8aa..1fdefd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,24 +46,30 @@ version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +[[package]] +name = "arc-swap" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" + [[package]] name = "askama" version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47cbc3cf73fa8d9833727bbee4835ba5c421a0d65b72daf9a7b5d0e0f9cfb57e" +source = "git+https://github.com/TTWNO/askama/#b21ba00227ad5294c94dd228663aa5c98abe02f1" dependencies = [ "askama_derive", "askama_escape", + "fluent-templates", "humansize", "num-traits", + "parking_lot 0.12.1", "percent-encoding", ] [[package]] name = "askama_axum" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b336dea26a2eb67f04e1134385721f794b654a870ce5146d2fcb69ea39c3a4" +source = "git+https://github.com/TTWNO/askama/#b21ba00227ad5294c94dd228663aa5c98abe02f1" dependencies = [ "askama", "axum-core", @@ -73,10 +79,11 @@ dependencies = [ [[package]] name = "askama_derive" version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22fbe0413545c098358e56966ff22cdd039e10215ae213cfbd65032b119fc94" +source = "git+https://github.com/TTWNO/askama/#b21ba00227ad5294c94dd228663aa5c98abe02f1" dependencies = [ "basic-toml", + "fluent-syntax", + "fluent-templates", "mime", "mime_guess", "nom", @@ -89,8 +96,7 @@ dependencies = [ [[package]] name = "askama_escape" version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" +source = "git+https://github.com/TTWNO/askama/#b21ba00227ad5294c94dd228663aa5c98abe02f1" [[package]] name = "async-stream" @@ -515,6 +521,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "displaydoc" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "dotenvy" version = "0.15.7" @@ -533,6 +556,98 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "fluent" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f69378194459db76abd2ce3952b790db103ceb003008d3d50d97c41ff847a7" +dependencies = [ + "fluent-bundle", + "unic-langid", +] + +[[package]] +name = "fluent-bundle" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e242c601dec9711505f6d5bbff5bedd4b61b2469f2e8bb8e57ee7c9747a87ffd" +dependencies = [ + "fluent-langneg", + "fluent-syntax", + "intl-memoizer", + "intl_pluralrules", + "rustc-hash", + "self_cell", + "smallvec", + "unic-langid", +] + +[[package]] +name = "fluent-langneg" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c4ad0989667548f06ccd0e306ed56b61bd4d35458d54df5ec7587c0e8ed5e94" +dependencies = [ + "unic-langid", +] + +[[package]] +name = "fluent-syntax" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0abed97648395c902868fee9026de96483933faa54ea3b40d652f7dfe61ca78" +dependencies = [ + "thiserror", +] + +[[package]] +name = "fluent-template-macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec7592cd1f45c1afe9084ce59c62a3a7c266c125c4c2ec97e95b0563c4aa914" +dependencies = [ + "flume", + "ignore", + "once_cell", + "proc-macro2", + "quote", + "syn 1.0.109", + "unic-langid", +] + +[[package]] +name = "fluent-templates" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c3ef2c2152757885365abce32ddf682746062f1b6b3c0824a29fbed6ee4d080" +dependencies = [ + "arc-swap", + "fluent", + "fluent-bundle", + "fluent-langneg", + "fluent-syntax", + "fluent-template-macros", + "flume", + "heck", + "ignore", + "intl-memoizer", + "lazy_static", + "log", + "once_cell", + "serde_json", + "snafu", + "unic-langid", +] + +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "spin 0.9.8", +] + [[package]] name = "fnv" version = "1.0.7" @@ -598,7 +713,7 @@ checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" dependencies = [ "futures-core", "lock_api", - "parking_lot", + "parking_lot 0.11.2", ] [[package]] @@ -932,6 +1047,25 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "intl-memoizer" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c310433e4a310918d6ed9243542a6b83ec1183df95dff8f23f87bb88a264a66f" +dependencies = [ + "type-map", + "unic-langid", +] + +[[package]] +name = "intl_pluralrules" +version = "7.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "078ea7b7c29a2b4df841a7f6ac8775ff6074020c6776d48491ce2268e068f972" +dependencies = [ + "unic-langid", +] + [[package]] name = "itertools" version = "0.10.5" @@ -1139,7 +1273,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.7", ] [[package]] @@ -1156,6 +1300,19 @@ dependencies = [ "winapi", ] +[[package]] +name = "parking_lot_core" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + [[package]] name = "parse-zoneinfo" version = "0.3.0" @@ -1322,6 +1479,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + [[package]] name = "proc-macro2" version = "1.0.56" @@ -1416,7 +1579,7 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi", @@ -1491,6 +1654,12 @@ dependencies = [ "serde_yaml", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -1564,6 +1733,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "self_cell" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af" + [[package]] name = "semver" version = "1.0.17" @@ -1728,6 +1903,28 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "snafu" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0656e7e3ffb70f6c39b3c2a86332bb74aa3c679da781642590f3c1118c5045" +dependencies = [ + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "475b3bbe5245c26f2d8a6f62d67c1f30eb9fffeccee721c45d162c3ebbdf81b2" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "socket2" version = "0.4.9" @@ -1744,6 +1941,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + [[package]] name = "sql-builder" version = "3.1.1" @@ -2016,6 +2222,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "tinystr" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ac3f5b6856e931e15e07b478e98c8045239829a65f9156d4fa7e7788197a5ef" +dependencies = [ + "displaydoc", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -2158,6 +2373,15 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +[[package]] +name = "type-map" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d3364c5e96cb2ad1603037ab253ddd34d7fb72a58bdddf4b7350760fc69a46" +dependencies = [ + "rustc-hash", +] + [[package]] name = "typenum" version = "1.16.0" @@ -2200,6 +2424,49 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" +[[package]] +name = "unic-langid" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "398f9ad7239db44fd0f80fe068d12ff22d78354080332a5077dc6f52f14dcf2f" +dependencies = [ + "unic-langid-impl", + "unic-langid-macros", +] + +[[package]] +name = "unic-langid-impl" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35bfd2f2b8796545b55d7d3fd3e89a0613f68a0d1c8bc28cb7ff96b411a35ff" +dependencies = [ + "tinystr", +] + +[[package]] +name = "unic-langid-macros" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055e618bf694161ffff0466d95cef3e1a5edc59f6ba1888e97801f2b4ebdc4fe" +dependencies = [ + "proc-macro-hack", + "tinystr", + "unic-langid-impl", + "unic-langid-macros-impl", +] + +[[package]] +name = "unic-langid-macros-impl" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f5cdec05b907f4e2f6843f4354f4ce6a5bebe1a56df320a49134944477ce4d8" +dependencies = [ + "proc-macro-hack", + "quote", + "syn 1.0.109", + "unic-langid-impl", +] + [[package]] name = "unic-segment" version = "0.9.0" diff --git a/Cargo.toml b/Cargo.toml index f204879..94afcf7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -askama = { version = "0.12.0", features = ["with-axum"] } -askama_axum = "0.3.0" -axum = { version = "0.6.12" } +askama = { git = "https://github.com/TTWNO/askama/", features = ["with-axum", "i18n"] } +askama_axum = { git = "https://github.com/TTWNO/askama/" } +axum = { version = "0.6.15" } axum-macros = "0.3.7" chrono = { version = "0.4.24", features = ["serde"] } serde = "1.0.158" diff --git a/i18n.toml b/i18n.toml index f32b7c4..2c50580 100644 --- a/i18n.toml +++ b/i18n.toml @@ -1 +1,12 @@ -fallback_language = "en-ca" +# Defaults to "en": +fallback_language = "en-CA" + +[fluent] +# Defaults to true: +use_isolating = false + +# Defaults to "i18n": +assets_dir = "translations" + +# Default to None: +# core_locales = "…" diff --git a/src/filters.rs b/src/filters.rs index 1012c51..36dae27 100644 --- a/src/filters.rs +++ b/src/filters.rs @@ -6,7 +6,3 @@ pub fn seconds_as_time(secs: &i32) -> ::askama::Result { let seconds = secs % 60; Ok(format!("{}:{}", minutes, seconds)) } - -pub fn intl(key: &str, lang: &SupportedLanguage) -> ::askama::Result { - Ok(t!(key, locale=&format!("{}", lang))) -} diff --git a/src/languages.rs b/src/languages.rs index 0f0ca5c..c5c97a4 100644 --- a/src/languages.rs +++ b/src/languages.rs @@ -1,3 +1,6 @@ +use crate::LOCALES; +use askama::i18n::{langid, LanguageIdentifier, Locale}; +use askama::i18n::fluent_templates::Loader; use serde::{ Serialize, Deserialize, @@ -20,3 +23,21 @@ pub enum SupportedLanguage { #[display(fmt="fr-ca")] French, } +impl Into for SupportedLanguage { + fn into(self) -> LanguageIdentifier { + match self { + Self::English => langid!("en-ca"), + Self::French => langid!("fr-ca"), + } + } +} +impl<'a> Into> for SupportedLanguage { + fn into(self) -> Locale<'a> { + Locale::new(self.into(), &LOCALES) + } +} +impl SupportedLanguage { + pub fn lookup(&self, key: &str) -> String { + LOCALES.lookup(&(*self).into(), key).expect("Unable to find key {key} in locale {self}.") + } +} diff --git a/src/main.rs b/src/main.rs index a1d8af6..30005ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,9 @@ mod model; mod views; mod languages; +use askama::i18n::{langid, Locale}; +askama::i18n::load!(LOCALES); + use crate::model::{Division, Game, GamePlayer, League, Player, Shot, Team, Language}; use serde::{Serialize, Deserialize}; @@ -11,9 +14,6 @@ use serde::{Serialize, Deserialize}; use views::{GoalDetails, PlayerStats, ShotDetails, TeamStats, IihfStatsI64}; use languages::SupportedLanguage; -use rust_i18n::t; -rust_i18n::i18n!("translations"); - use askama::Template; use axum::{ extract::{Path, State}, @@ -28,12 +28,6 @@ use sqlx::{Pool, Postgres}; use std::net::SocketAddr; use std::sync::Arc; -macro_rules! intl { - ($key:expr) => { - t!($key, locale=path.as_ref()) - } -} - #[derive(Template)] #[template(path = "hello.html")] struct HelloTemplate<'a> { @@ -43,27 +37,35 @@ struct HelloTemplate<'a> { #[derive(Template)] #[template(path = "language_list.html")] -struct LanguageListTemplate { +struct LanguageListTemplate<'a> { + #[locale] + pub loc: Locale<'a>, pub languages: Vec, } #[derive(Template)] #[template(path = "partials/box_score_table.html")] -struct BoxScoreTemplate { +struct BoxScoreTemplate<'a> { + #[locale] + locale: Locale<'a>, goals: Vec, lang: SupportedLanguage, } #[derive(Template)] #[template(path = "partials/individual_game_points_table.html")] -struct IndividualGamePointsTableTemplate { +struct IndividualGamePointsTableTemplate<'a> { + #[locale] + locale: Locale<'a>, players: Vec, lang: SupportedLanguage, } #[derive(Template)] #[template(path = "partials/team_stats_table.html")] -struct TeamGameStatsTemplate { +struct TeamGameStatsTemplate<'a> { + #[locale] + locale: Locale<'a>, teams: Vec, lang: SupportedLanguage, } @@ -78,7 +80,9 @@ struct DivisionListTemplate { #[derive(Template)] #[template(path = "league_list.html")] -struct LeagueListTemplate { +struct LeagueListTemplate<'a> { + #[locale] + locale: Locale<'a>, leagues: Vec, heading: String, lang: SupportedLanguage, @@ -86,36 +90,42 @@ struct LeagueListTemplate { #[derive(Template)] #[template(path="partials/iihf_team_stats_table.html")] -struct IihfTeamStatsTableTemplate { +struct IihfTeamStatsTableTemplate<'a> { + #[locale] + locale: Locale<'a>, lang: SupportedLanguage, iihf_stats: Vec, } #[derive(Template)] #[template(path = "game_list.html")] -struct GameListTemplate { +struct GameListTemplate<'a> { division: Division, - iihf_team_stats_table: IihfTeamStatsTableTemplate, + iihf_team_stats_table: IihfTeamStatsTableTemplate<'a>, games: Vec, lang: SupportedLanguage, } #[derive(Template)] #[template(path = "partials/play_by_play_table.html")] -struct ShotsTableTemplate { +struct ShotsTableTemplate<'a> { + #[locale] + locale: Locale<'a>, shots: Vec, lang: SupportedLanguage, } #[derive(Template)] #[template(path = "game_score_page.html")] -struct GameScorePageTemplate { +struct GameScorePageTemplate<'a> { + #[locale] + locale: Locale<'a>, game: Game, division: Division, - box_score: BoxScoreTemplate, - team_stats: TeamGameStatsTemplate, - individual_stats: IndividualGamePointsTableTemplate, - play_by_play: ShotsTableTemplate, + box_score: BoxScoreTemplate<'a>, + team_stats: TeamGameStatsTemplate<'a>, + individual_stats: IndividualGamePointsTableTemplate<'a>, + play_by_play: ShotsTableTemplate<'a>, lang: SupportedLanguage, } @@ -136,21 +146,19 @@ pub struct ServerState { #[tokio::main] async fn main() { - println!("{}", t!("game_url", locale="en-ca")); - println!("{:?}", available_locales()); let pool = db::connect().await; let state = ServerState { db_pool: Arc::new(pool), }; let router = Router::new() .route("/", get(language_list)) - .route(&t!("home_url", locale="en-ca"), get(league_html)) + .route("/:lang/", get(league_html)) .route("/:lang/shots/", get(shots_all)) .route("/:lang/test/", get(test_template)) - .route(&t!("league_url", locale="en-ca"), get(divisions_for_league_html)) - .route(&t!("division_url", locale="en-ca"), get(games_for_division_html)) - .route(&t!("game_url", locale="en-ca"), get(score_for_game_html)) - .route(&t!("game_url", locale="fr-ca"), get(score_for_game_html)) + .route(&SupportedLanguage::English.lookup("league_url"), get(divisions_for_league_html)) + .route(&SupportedLanguage::English.lookup("division_url"), get(games_for_division_html)) + .route(&SupportedLanguage::English.lookup("game_url"), get(score_for_game_html)) + .route(&SupportedLanguage::French.lookup("game_url"), get(score_for_game_html)) .route("/:lang/player/:name/", get(player_from_name)) .with_state(state); let addr = SocketAddr::from(([127, 0, 0, 1], 8000)); @@ -168,6 +176,7 @@ async fn language_list( .await .unwrap(); let lang_list_tmpl = LanguageListTemplate { + loc: Locale::new(langid!("en-ca"), &LOCALES), languages }; (StatusCode::OK, lang_list_tmpl) @@ -243,6 +252,7 @@ async fn league_html( } .to_string(); let leagues_template = LeagueListTemplate { + locale: lang.into(), leagues, heading, lang, @@ -284,6 +294,7 @@ async fn games_for_division_html( let games_template = GameListTemplate { division, iihf_team_stats_table: IihfTeamStatsTableTemplate { + locale: lang.into(), iihf_stats, lang, }, @@ -308,21 +319,24 @@ async fn score_for_game_html( .await .unwrap(); let score = game.score(&server_config.db_pool).await.unwrap(); - let score_html = TeamGameStatsTemplate { teams: score, lang }; + let score_html = TeamGameStatsTemplate { locale: lang.into(), teams: score, lang }; let goal_details = game.box_score(&server_config.db_pool) .await .unwrap(); let goal_details_html = IndividualGamePointsTableTemplate { + locale: lang.into(), players: goal_details, lang, }; let box_score = game.goals(&server_config.db_pool).await.unwrap(); let box_score_html = BoxScoreTemplate { + locale: lang.into(), goals: box_score, lang, }; - let pbp_html = ShotsTableTemplate { shots: pbp, lang }; + let pbp_html = ShotsTableTemplate { locale: lang.into(), shots: pbp, lang }; let game_template = GameScorePageTemplate { + locale: lang.into(), division, game, lang, diff --git a/templates/game_score_page.html b/templates/game_score_page.html index 77e1cca..0037b9e 100644 --- a/templates/game_score_page.html +++ b/templates/game_score_page.html @@ -3,13 +3,13 @@ {% block title %}{{ game.name }}{% endblock %} {% block content %} -

{{ game.name }} of the {{ division.name }}

-

Team

+

{{ localize("game-of-division", game: game.name.clone(), division: division.name.clone()) }}

+

{{ localize("team") }}

{{ team_stats|safe }} -

Individual

+

{{ localize("individual") }}

{{ individual_stats|safe }} -

Box Score

+

{{ localize("box-score") }}

{{ box_score|safe }} -

Play-by-Play

+

{{ localize("play-by-play") }}

{{ play_by_play|safe }} {% endblock %} diff --git a/templates/language_list.html b/templates/language_list.html index ece5f39..00bdf08 100644 --- a/templates/language_list.html +++ b/templates/language_list.html @@ -3,7 +3,7 @@ {% block title %}Select Your Language{% endblock %} {% block content %} -

Select Your Language

+

{{ localize("language_selection") }}

{% if languages.len() > 0 %}
    {% for lang in languages %} diff --git a/templates/league_list.html b/templates/league_list.html index ac64727..a89e571 100644 --- a/templates/league_list.html +++ b/templates/league_list.html @@ -3,7 +3,7 @@ {% block title %}Leagues{% endblock %} {% block content %} -

    {{ heading }}

    +

    {{ localize("league_ibihf") }}

      {% for league in leagues %}
    1. {{ league.name }}
    2. diff --git a/templates/partials/box_score_table.html b/templates/partials/box_score_table.html index 03db84c..33ab5ff 100644 --- a/templates/partials/box_score_table.html +++ b/templates/partials/box_score_table.html @@ -1,12 +1,12 @@ - + - - - - + + + + {% for goal in goals %} diff --git a/templates/partials/iihf_team_stats_table.html b/templates/partials/iihf_team_stats_table.html index 236ffc9..563bc41 100644 --- a/templates/partials/iihf_team_stats_table.html +++ b/templates/partials/iihf_team_stats_table.html @@ -1,13 +1,13 @@
      Scorer - Team{{ localize("scorer") }} + {{ localize("team") }} #PeriodTimeAssistSecondary Assist{{ localize("period") }}{{ localize("time") }}{{ localize("assist") }}{{ localize("assist_second") }}
      - - - - - - - + + + + + + + diff --git a/templates/partials/individual_game_points_table.html b/templates/partials/individual_game_points_table.html index 9b3680c..d7e0738 100644 --- a/templates/partials/individual_game_points_table.html +++ b/templates/partials/individual_game_points_table.html @@ -1,10 +1,10 @@
      {{ "game_plural"|intl(lang)|capitalize }}PointsRWRLOWOLT{{ localize("game_plural") }}{{ localize("point_plural") }}{{ localize("reg_wins_short") }}{{ localize("reg_losses_short") }}{{ localize("ot_wins_short") }}{{ localize("ot_losses_short") }}{{ localize("ties_short") }}
      - - - - + + + + diff --git a/templates/partials/play_by_play_table.html b/templates/partials/play_by_play_table.html index d76e707..184c1ab 100644 --- a/templates/partials/play_by_play_table.html +++ b/templates/partials/play_by_play_table.html @@ -1,13 +1,13 @@
      NamePointsGoalsAssists{{ localize("name") }}{{ localize("point_plural") }}{{ localize("goal_plural") }}{{ localize("assist_plural") }}
      - + - - - - - + + + + + {% for shot in shots %} diff --git a/templates/partials/team_stats_table.html b/templates/partials/team_stats_table.html index 8bf6512..cefe87a 100644 --- a/templates/partials/team_stats_table.html +++ b/templates/partials/team_stats_table.html @@ -1,9 +1,9 @@
      Shooter - Team{{ localize("shooter") }} + {{ localize("team") }} #TypePeriodTimeAssistSecondary Assist{{ localize("type") }}{{ localize("period") }}{{ localize("time") }}{{ localize("assist") }}{{ localize("assist_second") }}
      - - - + + + diff --git a/translations/en-CA/terms.ftl b/translations/en-CA/terms.ftl new file mode 100644 index 0000000..576f1fb --- /dev/null +++ b/translations/en-CA/terms.ftl @@ -0,0 +1,27 @@ +game-of-division = { $game } of the { $division } +play-by-play = play-by-play +box-score = box score +individual = individual +type = type +shooter = shooter +scorer = scorer +period = period +time = time +assist_second = secondary assist +league_ibihf = IBIHF Leagues +language_selection = Please choose your language +game = game +game_plural = games +point = point +point_plural = points +goal = goal +goal_plural = goals +assist = assist +assist_plural = assists +name = name +team = team +reg_wins_short = W +reg_losses_short = L +ot_wins_short = OTW +ot_losses_short = OTL +ties_short = T diff --git a/translations/en-CA/urls.ftl b/translations/en-CA/urls.ftl new file mode 100644 index 0000000..f80243c --- /dev/null +++ b/translations/en-CA/urls.ftl @@ -0,0 +1,6 @@ +game_url = /:lang/games/:id/ +game_url_tmpl = /{ $lang }/games/{ $id }/ +league_url = /:lang/league/:id/ +league_url_tmpl = /{ $lang }/league/{ $id }/ +division_url = /:lang/division/:id/ +division_url_tmpl = /{ $lang }/division/{ $id }/ diff --git a/translations/en-ca.yml b/translations/en-ca.yml deleted file mode 100644 index 52e0ed1..0000000 --- a/translations/en-ca.yml +++ /dev/null @@ -1,17 +0,0 @@ -home_url: /:lang/ -game_url: /:lang/game/:id/ -league_url: /:lang/league/:id/ -division_url: /:lang/division/:id/ -test: 123 -welcome: Welcome! -test2: 123123 -message: Can we %{go} to the store? -hello: Hello World -point: point -point_plural: points -goal: goal -goal_plural: goals -assist: assist -assist_plural: assists -name: name -team: team diff --git a/translations/fr-CA/terms.ftl b/translations/fr-CA/terms.ftl new file mode 100644 index 0000000..d663684 --- /dev/null +++ b/translations/fr-CA/terms.ftl @@ -0,0 +1,26 @@ +game-of-division = { $game } de le { $division } +play-by-play = jeu-par-jeu +box-score = score de la boîte +individual = individu +period = période +shooter = tireur +time = temps +assist_second = aide secondaire +scorer = buteur +league_ibihf = League de FIDHS +language_selection = Veuillez choisir votre langue +game = match +game_plural = matches +point = point +point_plural = points +goal = but +goal_plural = buts +assist = aide +assist_plural = aides +name = nom +team = équipe +reg_wins_short = G +reg_losses_short = P +ot_wins_short = PW +ot_losses_short = PL +ties_short = E diff --git a/translations/fr-CA/urls.ftl b/translations/fr-CA/urls.ftl new file mode 100644 index 0000000..a617ed6 --- /dev/null +++ b/translations/fr-CA/urls.ftl @@ -0,0 +1,2 @@ +game_url = /:lang/match/:id/ +game_url_tmpl = /{ $lang }/match/{ $id }/ diff --git a/translations/fr-ca.yml b/translations/fr-ca.yml deleted file mode 100644 index be54530..0000000 --- a/translations/fr-ca.yml +++ /dev/null @@ -1,11 +0,0 @@ -game_url: /:lang/match/:id/ -game: match -game_plural: matches -point: point -point_plural: points -goal: but -goal_plural: buts -assist: aide -assist_plural: aides -name: nom -team: équipe
      TeamGoalsShots{{ localize("team") }}{{ localize("goal_plural") }}{{ localize("assist_plural") }}