mirror of
https://gitlab.com/niansa/anyproc.git
synced 2025-03-06 20:49:24 +01:00
Accept string view in translate() and lookup()
This commit is contained in:
parent
1f43f4d88b
commit
a7a4ba62a4
1 changed files with 2 additions and 2 deletions
|
@ -120,7 +120,7 @@ public:
|
|||
.example("['Ap', 'ple', 'tree']");
|
||||
}
|
||||
|
||||
std::string lookup(const std::string& word, const std::string& what, const std::function<bool (float)> &on_append_tick = nullptr, const std::function<bool (const char *generated)>& on_generation_tick = nullptr) {
|
||||
std::string lookup(std::string_view word, const std::string& what, const std::function<bool (float)> &on_append_tick = nullptr, const std::function<bool (const char *generated)>& on_generation_tick = nullptr) {
|
||||
return begin().expression(word_lookup_exprgen(escape(word))+'.'+what)
|
||||
.run(on_append_tick, on_generation_tick);
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
.example("'Bitte kündige auf dem Server NICHT an, dass du masturbieren gehen wirst. Dies ist ein wiederkehrendes Problem, und ich bin mir nicht sicher, warum einige Leute so unterentwickelte soziale Fähigkeiten haben, dass sie denken, dass ein Server voller meist männlicher Fremder das wissen muss. Niemand wird beeindruckt sein und dir ein High Five geben (besonders wenn man bedenkt, wo diese Hand war). Ich möchte dies nicht zu den Regeln hinzufügen, da es für neue Benutzer peinlich wäre, zu sehen, dass wir ein Problem damit haben, aber es wird von nun an als Regel durchgesetzt werden.'");
|
||||
}
|
||||
|
||||
std::string translate(const std::string& text, const std::string& language, const std::function<bool (float)> &on_append_tick = nullptr, const std::function<bool (const char *generated)>& on_generation_tick = nullptr) {
|
||||
std::string translate(std::string_view text, std::string_view language, const std::function<bool (float)> &on_append_tick = nullptr, const std::function<bool (const char *generated)>& on_generation_tick = nullptr) {
|
||||
return unescape(begin().expression(translation_exprgen(escape(text), escape(language)))
|
||||
.run(on_append_tick, on_generation_tick));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue