This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/38573] Missing markers for translation


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38573

--- Comment #11 from Frederic Marchal <fmarchal at perso dot be> ---
(In reply to Roland Illig from comment #9)
> (In reply to Jerry DeLisle from comment #7)
> >   /* Otherwise, fail.  */
> >   if (symstd)
> >     *symstd = _(symstd_msg);
> >   return false;
> > 
> > Where the mark is on the symstd_msg after it is set to one of the above
> > cases.  Are you saying this does not work?  Does the translation mark need
> > to be on all and not in one place?
> 
> Yes, the translation mark needs to be around each string literal that should
> be translated. xgettext (which extracts the strings from source code) only
> looks at the source code, but never executes the program to see what really
> happens. That's good enough for all practical cases.

I suspect a misunderstanding here. Forgive me if I state the obvious.

The fix is not to move the translation mark around.

String literals must be identified as to be translated by a human translator
(something like symstd_msg=N_("string")) in the source code. Then the string
must also be replaced with its translation at runtime by a call to
gettext(symstd_msg) (usually shortened as _(symstd_msg) by a define).

The above code does call _(symstd_msg) to translate the string at runtime (as
it should) but the string literals pointed to by symstd_msg are not marked as
translatable. Translators never see them. Therefore, when gettext() is passed
the string "available since Fortran 77", it can't find its translation in the
mo file. 

In most cases, the two steps are combined in one call to _("string") that
contains both the string literal extracted by xgettext and the call to
gettext() to actually translate it at runtime.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]