summaryrefslogblamecommitdiff
path: root/npc/commands/language.txt
blob: ce7122f5ecb30f48fe627c54a1c4954d5b464b9c (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	{
    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;
}