コード例 #1
0
 public function testCustomSeparator()
 {
     $instance = new IntlNumberFormatter(10000000);
     $instance->setOption('separator.decimal', 'FOO');
     $instance->setOption('separator.thousands', 'BAR');
     $this->assertEquals('FOO', $instance->getSeparatorByLanguage(IntlNumberFormatter::DECIMAL_SEPARATOR, 'zzz'));
     $this->assertEquals('BAR', $instance->getSeparatorByLanguage(IntlNumberFormatter::THOUSANDS_SEPARATOR, 'zzz'));
 }
コード例 #2
0
 private function findPreferredLanguageFrom(&$formatstring)
 {
     // Localized preferred user language
     if (strpos($formatstring, 'LOCL') !== false && ($languageCode = Localizer::getLanguageCodeFrom($formatstring)) !== false) {
         $this->intlNumberFormatter->setOption('preferred.language', $languageCode);
     }
     // Remove any remaining
     $formatstring = str_replace(array('#LOCL', 'LOCL'), '', $formatstring);
 }