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) 또는 당신은 포맷터 클래스를 확장하고 자신의 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',
],
],