i'm not an expert on this but this makes sense.
i guess after
gettext() does its thing, truncate the result to however many bytes:
[pseudo-code]
Code:
if strlen(c_string) > max
c_string[max] = '\0'
[/pseudo-code]
not sure why you would want to underscore-pad the input (is the probelm the input is too long or too small?)
edit: i see - your solution would make everything constant len.
(a small waste of mem)