AnnieRuru
~~Cute~Cute~Scripter~~
- Messages
- 1,677
- Points
- 0
- Location
- your next door ~
- Discord
- AnnieRuru#1609
- Github
- AnnieRuru
- Emulator
- Client Version
- 2019-05-30aRagexeRE
What is the difference between _("<string>") and _$("<string>") meant for HULD
I found a few clues in script.c
else if( strcmp(buildin->name, "mes") == 0 ) script->buildin_mes_offset = script->buildin_count;
else if( strcmp(buildin->name, "mesf") == 0 ) script->buildin_mesf_offset = script->buildin_count;
else if( strcmp(buildin->name, "select") == 0 ) script->buildin_select_offset = script->buildin_count;
else if( strcmp(buildin->name, "_") == 0 ) script->buildin_lang_macro_offset = script->buildin_count;
else if( strcmp(buildin->name, "_$") == 0 ) script->buildin_lang_macro_fmtstring_offset = script->buildin_count;
so its script->buildin_lang_macro_offset and script->buildin_lang_macro_fmtstring_offset
next, in generate-translations.c
if (!duplicate) {
if (script->syntax.last_func == script->buildin_mes_offset
|| script->syntax.last_func == script->buildin_select_offset
|| script->syntax.lang_macro_active
) {
is_translatable_string = true;
} else if (script->syntax.last_func == script->buildin_mesf_offset
|| script->syntax.lang_macro_fmtstring_active
) {
is_translatable_fmtstring = true;
}
}
now this make sense, _("<string>") is somehow group together with mes and select
_$("<string>") is somehow group together with mesf
so this is my guess ...
_("<string>") is for those without %d %s ...
_$("<string>") is for those with %d %s ... like sprintf ... right ?
so ... my next question is ... there are 3 types
<none>
c format
no c format
what are those actually means then ?
if translate by hand, it probably doesn't mean anything ...
line 187 in generate-translations.c
is_translatable_fmtstring ? "#, c-format\n" : (has_percent_sign ? "#, no-c-format\n" : ""),
@Haru @Dastgir
I found a few clues in script.c
else if( strcmp(buildin->name, "mes") == 0 ) script->buildin_mes_offset = script->buildin_count;
else if( strcmp(buildin->name, "mesf") == 0 ) script->buildin_mesf_offset = script->buildin_count;
else if( strcmp(buildin->name, "select") == 0 ) script->buildin_select_offset = script->buildin_count;
else if( strcmp(buildin->name, "_") == 0 ) script->buildin_lang_macro_offset = script->buildin_count;
else if( strcmp(buildin->name, "_$") == 0 ) script->buildin_lang_macro_fmtstring_offset = script->buildin_count;
so its script->buildin_lang_macro_offset and script->buildin_lang_macro_fmtstring_offset
next, in generate-translations.c
if (!duplicate) {
if (script->syntax.last_func == script->buildin_mes_offset
|| script->syntax.last_func == script->buildin_select_offset
|| script->syntax.lang_macro_active
) {
is_translatable_string = true;
} else if (script->syntax.last_func == script->buildin_mesf_offset
|| script->syntax.lang_macro_fmtstring_active
) {
is_translatable_fmtstring = true;
}
}
now this make sense, _("<string>") is somehow group together with mes and select
_$("<string>") is somehow group together with mesf
so this is my guess ...
_("<string>") is for those without %d %s ...
_$("<string>") is for those with %d %s ... like sprintf ... right ?
so ... my next question is ... there are 3 types
<none>
c format
no c format
- script asdf FAKE_NPC,{
.@a$ = _("test");
.@b$ = _$("nothing");
end;
OnInit:
bindatcmd "mobcount", strnpcinfo(NPC_NAME)+"::Onaaa";
end;
Onaaa:
if ( !.@atcmd_numparameters ) {
dispbottom "input a mob ID";
end;
}
.@mobid = atoi( .@atcmd_parameters$ );
if ( getmonsterinfo( .@mobid, MOB_LV ) == -1 ) {
dispbottom "invalid monster ID";
end;
}
.@size = getunits( BL_MOB, .@bl, false, strcharinfo(PC_MAP) );
for ( .@i = 0; .@i < .@size; ++.@i )
if ( getunitdata( .@bl[.@i], UDT_CLASS ) == .@mobid )
++.@c;
dispbottom sprintf(_("There are %1$dx %2$s in %3$s."), .@c, getmonsterinfo( .@mobid, MOB_NAME ), strcharinfo(PC_MAP) );
end;
}
generate the file as
.@a$ = _("test");
.@b$ = _$("nothing");
end;
OnInit:
bindatcmd "mobcount", strnpcinfo(NPC_NAME)+"::Onaaa";
end;
Onaaa:
if ( !.@atcmd_numparameters ) {
dispbottom "input a mob ID";
end;
}
.@mobid = atoi( .@atcmd_parameters$ );
if ( getmonsterinfo( .@mobid, MOB_LV ) == -1 ) {
dispbottom "invalid monster ID";
end;
}
.@size = getunits( BL_MOB, .@bl, false, strcharinfo(PC_MAP) );
for ( .@i = 0; .@i < .@size; ++.@i )
if ( getunitdata( .@bl[.@i], UDT_CLASS ) == .@mobid )
++.@c;
dispbottom sprintf(_("There are %1$dx %2$s in %3$s."), .@c, getmonsterinfo( .@mobid, MOB_NAME ), strcharinfo(PC_MAP) );
end;
}
generate the file as
Code:
#: npc/zzz.txt
# .@a$ = _("test");
msgctxt "asdf"
msgid "test"
msgstr ""
#: npc/zzz.txt
# .@b$ = _$("nothing");
#, c-format
msgctxt "asdf"
msgid "nothing"
msgstr ""
#: npc/zzz.txt
# dispbottom sprintf(_("There are %1$dx %2$s in %3$s."), .@c, getmonsterinfo( .@mobid, MOB_NAME ), strcharinfo(PC_MAP) );
#, no-c-format
msgctxt "asdf"
msgid "There are %1$dx %2$s in %3$s."
msgstr ""
if translate by hand, it probably doesn't mean anything ...
line 187 in generate-translations.c
is_translatable_fmtstring ? "#, c-format\n" : (has_percent_sign ? "#, no-c-format\n" : ""),
@Haru @Dastgir