Add Japanese flavor text to the example pokemon service (#1480)

This commit is contained in:
J.R. Hill 2022-06-28 03:37:30 -07:00 committed by GitHub
parent 424d736768
commit a183204493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -98,6 +98,11 @@ structure FlavorText {
value: "it",
documentation: "Italiano.",
},
{
name: "JAPANESE",
value: "jp",
documentation: "日本語。",
},
])
string Language

View File

@ -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() {
@ -42,6 +44,7 @@ struct PokemonTranslations {
en: String,
es: String,
it: String,
jp: String,
}
/// PokémonService shared state.
@ -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 {
@ -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"),