bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] Is there a way to generate an error message when an en


From: Bruno Haible
Subject: Re: [bug-gettext] Is there a way to generate an error message when an env variable is not available? (envsubst)
Date: Sat, 26 Nov 2016 04:00:43 +0100
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

Hi,

Peng Yu wrote:
> xxx is not defined in the enviroment. I'd like envsubst to show an
> error message. But there is not such an option available as of now.
> Can this feature be added?
> 
> ~$ cat template.txt
> The word is $foo
> The word is $xxxx
> ~$ word=foo envsubst < template.txt
> The word is foo
> The word is

Why do you need this? envsubst is an auxiliary program for eval_gettext.
For example

  eval_gettext 'The word is $foo'

produces a POT file that contains

  #, sh-format
  msgid "The word is $foo"
  msgstr ""

If the translator has provided the translation

  #, sh-format
  msgid "The word is $foo"
  msgstr "The word is $xxxx"

"msfgmt -c" will produce an error:

  a format specification for argument 'foo' doesn't exist in 'msgstr'

So, the string "The word is $xxxx" will not even end up in a .mo file.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]