Skip to content

Commit

Permalink
feat(locale): add German (#4)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Dieminger <[email protected]>
  • Loading branch information
caugner and fiji-flo authored Oct 9, 2024
1 parent 6cf911a commit ba457cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/rari-md/src/node_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ pub enum NoteCard {
impl NoteCard {
pub fn prefix_for_locale(&self, locale: Locale) -> &str {
match (self, locale) {
(Self::Callout, Locale::De) => "Aufruf:",
(Self::Warning, Locale::De) => "Warnung:",
(Self::Note, Locale::De) => "Hinweis:",
(Self::Callout, Locale::EnUs) => "Callout:",
(Self::Warning, Locale::EnUs) => "Warning:",
(Self::Note, Locale::EnUs) => "Note:",
Expand Down
7 changes: 7 additions & 0 deletions crates/rari-types/src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub enum Native {
#[default]
#[serde(rename = "English (US)")]
EnUS,
#[serde(rename = "Deutsch")]
De,
#[serde(rename = r#"Español"#)]
Es,
#[serde(rename = r#"Français"#)]
Expand All @@ -35,6 +37,7 @@ impl From<Locale> for Native {
fn from(value: Locale) -> Self {
match value {
Locale::EnUs => Self::EnUS,
Locale::De => Self::De,
Locale::Es => Self::Es,
Locale::Fr => Self::Fr,
Locale::Ja => Self::Ja,
Expand Down Expand Up @@ -64,6 +67,8 @@ pub enum Locale {
#[default]
#[serde(rename = "en-US")]
EnUs,
#[serde(rename = "de")]
De,
#[serde(rename = "es")]
Es,
#[serde(rename = "fr")]
Expand Down Expand Up @@ -111,6 +116,7 @@ impl Locale {
pub const fn as_url_str(&self) -> &str {
match *self {
Self::EnUs => "en-US",
Self::De => "de",
Self::Es => "es",
Self::Fr => "fr",
Self::Ja => "ja",
Expand Down Expand Up @@ -142,6 +148,7 @@ impl FromStr for Locale {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"en-US" | "en-us" => Ok(Self::EnUs),
"de" => Ok(Self::De),
"es" => Ok(Self::Es),
"fr" => Ok(Self::Fr),
"ja" => Ok(Self::Ja),
Expand Down

0 comments on commit ba457cf

Please sign in to comment.