On 12/10/2010 09:40 AM, Osier Yang wrote:
>
> case QEMU_JOB_MIGRATION_OUT:
> job = _("guest unexpectedly quit during migration");
> break;
> case QEMU_JOB_SAVE:
> job = _("guest unexpectedly quit during domain saving");
> break;
>
I realized this problem, but "job" will be used in many places,
it's hard to make a uniform translated string for all of them,
unless we try to define many diffrent variables, e.g. job0, job1,
etc. but that's really ugly.
Do you have any further idea? Thanks a lot.
The only other idea I have is to rearrange the error messages to be a
form of concatenated complete phrases (and there's precedence for this).
First, let's figure out if these look like reasonable strings, where
everything left of : can be translated independently, and everything
right of : can be translated independently, and the results still make
sense when the two pieces are strung together.
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("guest unexpectedly quit during %s"), job);
goto cleanup;
xyz job: guest unexpectedly quit
- "%s", _("Migration is not
active"));
+ _("%s is not active"), job);
break;
xyz job: job not active
- "%s", _("Migration was
cancelled by client"));
+ _("%s was cancelled by client"), job);
break;
xyz job: canceled by client
Then this is easy to do:
case QEMU_JOB_MIGRATION_OUT:
job = _("migration job");
break;
case QEMU_JOB_SAVE:
job = _("domain save job");
break;
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s: %s", job,
_("guest unexpectedly quit"));
(as for canceled vs. cancelled, that's a US vs. UK spelling thing; we've
made patches in the past to change to US spelling within translated
strings to give translators a single dialect to start from).
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org