asSpellout()は、PHPの国際拡張を使用します。
1)異なるオプションと直接MessageFormatterまたはNumberFormatterはを使用してみてください:
MessageFormatter::formatMessage("lv_LV", "{0, spellout}",[1978]);
がhttp://intl.rmcreative.ru/site/message-formatting?locale=lv_LV "メッセージのフォーマット" や詳細については、 "数の書式設定" タブを参照してください。
2)また、翻訳を使用することができます
echo \Yii::t('app', '{0, number} is spelled as {0, spellout}', [1978]);
3)それとも、Formatterクラスを拡張し、独自のasSpelloutメソッドを実装することができます
// components/Formatter.php
namespace app\components;
class Formatter extends \yii\i18n\Formatter
{
public function asSpellout ($value) {
...
}
}
をし、アプリケーション・コンポーネントとして、このクラスを設定し
// config/web.php
'components' => [
...
'formatter' => [
'class' => 'app\components\Formatter',
],
],