docscommment の注釈を翻訳する方法はありますか?
これが私の実際のコードの例です:
/**
*
* The Item Name
* @var string
* @Annotation\Options({"label":"Name"})
* @Annotation\Attributes({"type":"text"})
* @ORM\Column(type="string", length=128, nullable=false, unique=true)
*/
private $name;
テンプレート ファイルで生成されたフォーム ラベルを翻訳するには (小枝を使用):
<label for="{{field.getName()}}">
{{translate(field.getLabel())}}:
</label>
POEdit のようなパーサーがこの方法で「名前」という用語を見つけることができないことを除いて、これはうまく機能します。今のところ、モデルにプライベート メソッドを使用して、用語が存在することをパーサーに通知します...しかし、それは汚いです..
/**
* Unused in the software, used by external parser.
*/
private final function parseTranslations()
{
$this->translate('Name');
return null;
}
これを修正して docscomments の用語を翻訳するためのより良い解決策はありますか?