Skip to content

Commit

Permalink
feat(locale): add German
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Sep 18, 2024
1 parent ca1d06e commit 50d0e5e
Show file tree
Hide file tree
Showing 2 changed files with 9 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) => "Hinweis",
(Self::Warning, Locale::De) => "Warnung",
(Self::Note, Locale::De) => "Notiz",
(Self::Callout, Locale::EnUs) => "Callout:",
(Self::Warning, Locale::EnUs) => "Warning:",
(Self::Note, Locale::EnUs) => "Note:",
Expand Down
6 changes: 6 additions & 0 deletions crates/rari-types/src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use crate::globals::content_translated_root;
#[derive(PartialEq, Debug, Clone, Copy, Deserialize, Serialize, Default, PartialOrd, Eq, Ord)]
pub enum Native {
#[default]
#[serde(rename = "Deutsch")]
De,
#[serde(rename = "English (US)")]
EnUS,
#[serde(rename = r#"Español"#)]
Expand All @@ -33,6 +35,7 @@ pub enum Native {
impl From<Locale> for Native {
fn from(value: Locale) -> Self {
match value {
Locale::De => Self::De,
Locale::EnUs => Self::EnUS,
Locale::Es => Self::Es,
Locale::Fr => Self::Fr,
Expand Down Expand Up @@ -61,6 +64,8 @@ pub enum LocaleError {
)]
pub enum Locale {
#[default]
#[serde(rename = "de")]
De,
#[serde(rename = "en-US")]
EnUs,
#[serde(rename = "es")]
Expand Down Expand Up @@ -90,6 +95,7 @@ impl Display for Locale {
impl Locale {
pub const fn as_url_str(&self) -> &str {
match *self {
Self::De => "de",
Self::EnUs => "en-US",
Self::Es => "es",
Self::Fr => "fr",
Expand Down

0 comments on commit 50d0e5e

Please sign in to comment.