summaryrefslogtreecommitdiff
path: root/npc/commands/language.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/commands/language.txt')
-rw-r--r--npc/commands/language.txt60
1 files changed, 60 insertions, 0 deletions
diff --git a/npc/commands/language.txt b/npc/commands/language.txt
new file mode 100644
index 00000000..ce7122f5
--- /dev/null
+++ b/npc/commands/language.txt
@@ -0,0 +1,60 @@
+// TMW2 Script
+// Author: Jesusalva
+// With code parts from Julia (Evol)
+
+// @lang atcommand
+// Changes Language
+//
+// group lv: 0
+// group char lv: 0
+// log: False
+//
+// usage:
+// @lang
+//
+
+function script CMD_lang {
+ callfunc "checkclientversion";
+ mesq l("Which language do you speak?");
+ next;
+ asklanguage(LANG_IN_SHIP);
+ mes "";
+ mesn;
+ mesq l("Ok, done.");
+ return;
+}
+
+- script @lang 32767,{
+ end;
+
+OnCall:
+ CMD_lang();
+ close;
+
+OnTranslate:
+ // Implode, using a slash at whitespaces
+ .@request$ = implode(.@atcmd_parameters$, "%2F");
+ // No NPC provided?
+ if (.@request$ == "") {
+ dispbottom l("Usage: @translate <npc file>");
+ dispbottom l("Example: @translate Nard");
+ dispbottom l("Example: @translate Elmo");
+ dispbottom l("Example: @translate npc/002-1/arpan");
+ dispbottom l("PS. Doesn't always work. You need an account at %s and to be at ManaPlus Team.", "@@https://www.transifex.com/arctic-games|Transifex@@");
+ end;
+ }
+ // Add .txt extension of needed
+ if (!compare(.@request$, ".txt"))
+ .@request$ += ".txt";
+ // Fix stuff for URL format
+ .@request$ = replacestr(.@request$, "/", "%2F");
+ .@request$ = strtolower(.@request$);
+ // Give your translation link
+ dispbottom "@@https://www.transifex.com/arctic-games/moubootaur-legends/translate/#"+languagecode()+"/serverdata?q=occurrence%3A"+.@request$+"|Translate with Transifex@@";
+ close;
+
+OnInit:
+ bindatcmd "lang", "@lang::OnCall", 0, 60, 0;
+ bindatcmd "translate", "@lang::OnTranslate", 0, 60, 0;
+ end;
+}