summaryrefslogblamecommitdiff
path: root/npc/commands/language.txt
blob: 0a2927d3fdbbc9f6d9c0589fd60975b1bf0a5e81 (plain) (tree)
1
2
3
4



                                    










                   
                                         
                       
                                           




                              







                               

          








                                                            
                                                                                                                                                         


                                   

                                     






                                                                                                                                                                      
       
                                                
                                                          

        
// 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	{
    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/akaras|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/akaras/saulc-tmw-fork/translate/#"+languagecode()+"/server-data?q=occurrence%3A"+.@request$+"|Translate with Transifex@@";
    close;

OnInit:
    bindatcmd "lang", "@lang::OnCall", 0, 60, 0;
    bindatcmd "translate", "@lang::OnTranslate", 0, 60, 0;
    end;
}