Skip to content

Commit

Permalink
Add Japanese flavor text to the example pokemon service (#1480)
Browse files Browse the repository at this point in the history
  • Loading branch information
J.R. Hill authored Jun 28, 2022
1 parent 424d736 commit a183204
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions codegen-server-test/model/pokemon.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ structure FlavorText {
value: "it",
documentation: "Italiano.",
},
{
name: "JAPANESE",
value: "jp",
documentation: "日本語。",
},
])
string Language

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const PIKACHU_SPANISH_FLAVOR_TEXT: &str =
"Cuando varios de estos Pokémon se juntan, su energía puede causar fuertes tormentas.";
const PIKACHU_ITALIAN_FLAVOR_TEXT: &str =
"Quando vari Pokémon di questo tipo si radunano, la loro energia può causare forti tempeste.";
const PIKACHU_JAPANESE_FLAVOR_TEXT: &str =
"ほっぺたの りょうがわに ちいさい でんきぶくろを もつ。ピンチのときに ほうでんする。";

/// Setup `tracing::subscriber` to read the log level from RUST_LOG environment variable.
pub fn setup_tracing() {
Expand All @@ -42,6 +44,7 @@ struct PokemonTranslations {
en: String,
es: String,
it: String,
jp: String,
}

/// PokémonService shared state.
Expand Down Expand Up @@ -115,6 +118,7 @@ impl Default for State {
en: String::from(PIKACHU_ENGLISH_FLAVOR_TEXT),
es: String::from(PIKACHU_SPANISH_FLAVOR_TEXT),
it: String::from(PIKACHU_ITALIAN_FLAVOR_TEXT),
jp: String::from(PIKACHU_JAPANESE_FLAVOR_TEXT),
},
);
Self {
Expand Down Expand Up @@ -148,6 +152,10 @@ pub async fn get_pokemon_species(
flavor_text: pokemon.it.to_owned(),
language: model::Language::Italian,
},
model::FlavorText {
flavor_text: pokemon.jp.to_owned(),
language: model::Language::Japanese,
},
];
let output = output::GetPokemonSpeciesOutput {
name: String::from("pikachu"),
Expand Down

0 comments on commit a183204

Please sign in to comment.