summaryrefslogtreecommitdiff
path: root/npc/commands/language.txt
blob: ce7122f5ecb30f48fe627c54a1c4954d5b464b9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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;
}