dqroktbn005028 2015-02-09 09:37
浏览 79

翻译字符串和Poedit问题

I've encountered a translation issue for the given source;

<?php
$this->messageAdd($this->_("Ett okänt fel uppstod när %0 skulle skapas!", $term2), "error");
return $this->setResultCode(self::RESULT_ERROR);
?>

If I'm not blind this is a completely normal string and I have many alike in other source files but this specific one causes these lines in the po file;

#: ../../../../path/to/source_file.php:552
#, php-format
msgid "Ett okänt fel uppstod när %0 skulle skapas!"
msgstr "An unknown error occurred while creating the %0!"

With the error

Error: 'msgstr' is not a valid PHP format string, unlike 'msgid'. Reason: In the directive number 1, the character 'w' is not a valid conversation specifier.

What is the issue and why is it that only this string causes the error? If I remove the string from the source file no errors are generated in poedit.

Edit #1; I found this issue after further research and found that adding the comment /* xgettext:no-php-format */ before the translation string in the source file fixed the problem. It would be nice though to know why this happens only to the specified string and not to any other of my 5k+ strings.

  • 写回答

1条回答 默认 最新

  • doucu5836 2015-02-09 09:49
    关注

    Remove

    #, php-format
    

    directive from your .po files.

    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b