我的代码:
public function install()
{
$this->request->checkParam();
$country_code = $this->request->getGet('country_code');
$this->request->checkParam(false);
if (!Countries::exists($country_code)) {
$this->getMessageManager()->addWarning(__('国家不存在!代码:%1', $country_code));
$this->redirect($this->request->getUrlBuilder()->getBackendUrl('*/backend/countries/locales'));
}
$country = $this->i18n->getCountry($country_code);
$locales = $country->getLocales();
foreach ($locales as $key => $locale) {
unset($locales[$key]);
d($locale);
d(\Symfony\Component\Intl\Locales::getName($locale));
// $locales[] = [
// 'code' => $locale,
// 'name' => $this->i18n->getLocaleName($locale, Cookie::getLangLocal()),
// 'country_code' => $country_code
// ];
}
dd($locales);
}
^ "bo_CN"
^ "藏语(中国)"
^ "ii_CN"
^ "四川彝语(中国)"
^ "ug_CN"
^ "维吾尔语(中国)"
^ "yue_Hans_CN"
Fatal error: Uncaught Symfony\Component\Intl\Exception\ResourceBundleNotFoundException: The resource bundle "D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl/Resources/data/locales/root.php" does not exist. in D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\PhpBundleReader.php:38 Stack trace: #0 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\BufferedBundleReader.php(46): Symfony\Component\Intl\Data\Bundle\Reader\PhpBundleReader->read('D:\\wwwroot\\dev-...', 'root') #1 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\BundleEntryReader.php(88): Symfony\Component\Intl\Data\Bundle\Reader\BufferedBundleReader->read('D:\\wwwroot\\dev-...', 'root') #2 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\ResourceBundle.php(58): Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader->readEntry('D:\\wwwroot\\dev-...', 'zh_CN', Array, true) #3 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Locales.php(57): Symfony\Component\Intl\ResourceBundle::readEntry(Array, NULL) #4 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\I18n\Controller\Backend\Countries\Locales.php(54): Symfony\Component\Intl\Locales::getName('yue_Hans_CN') #5 [internal function]: Weline\I18n\Controller\Backend\Countries\Locales->install() #6 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Router\Core.php(352): call_user_func(Array) #7 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Router\Core.php(99): Weline\Framework\Router\Core->route() #8 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(152): Weline\Framework\Router\Core->start() #9 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(125): Weline\Framework\Router\Core\Interceptor->___callParentMethod('start', Array) #10 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(144): Weline\Framework\Router\Core\Interceptor->Weline\Framework\Interception\{closure}() #11 D:\wwwroot\dev-bbs.aiweline.com\generated\code\Weline\Framework\Router\Core\Interceptor.php(36): Weline\Framework\Router\Core\Interceptor->___callPlugins('start', Array, Array) #12 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\App.php(203): Weline\Framework\Router\Core\Interceptor->start() #13 D:\wwwroot\dev-bbs.aiweline.com\app\bootstrap.php(42): Weline\Framework\App::run() #14 D:\wwwroot\dev-bbs.aiweline.com\pub\index.php(11): require('D:\\wwwroot\\dev-...') #15 {main} Next Symfony\Component\Intl\Exception\MissingResourceException: Couldn't read the indices [Names][yue_Hans_CN] for the locale "zh_CN" in "D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl/Resources/data/locales". The indices also couldn't be found for the fallback locale(s) "zh_Hans", "zh", "en", "root". in D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\BundleEntryReader.php:175 Stack trace: #0 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\ResourceBundle.php(58): Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader->readEntry('D:\\wwwroot\\dev-...', 'zh_CN', Array, true) #1 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Locales.php(57): Symfony\Component\Intl\ResourceBundle::readEntry(Array, NULL) #2 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\I18n\Controller\Backend\Countries\Locales.php(54): Symfony\Component\Intl\Locales::getName('yue_Hans_CN') #3 [internal function]: Weline\I18n\Controller\Backend\Countries\Locales->install() #4 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Router\Core.php(352): call_user_func(Array) #5 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Router\Core.php(99): Weline\Framework\Router\Core->route() #6 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(152): Weline\Framework\Router\Core->start() #7 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(125): Weline\Framework\Router\Core\Interceptor->___callParentMethod('start', Array) #8 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(144): Weline\Framework\Router\Core\Interceptor->Weline\Framework\Interception\{closure}() #9 D:\wwwroot\dev-bbs.aiweline.com\generated\code\Weline\Framework\Router\Core\Interceptor.php(36): Weline\Framework\Router\Core\Interceptor->___callPlugins('start', Array, Array) #10 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\App.php(203): Weline\Framework\Router\Core\Interceptor->start() #11 D:\wwwroot\dev-bbs.aiweline.com\app\bootstrap.php(42): Weline\Framework\App::run() #12 D:\wwwroot\dev-bbs.aiweline.com\pub\index.php(11): require('D:\\wwwroot\\dev-...') #13 {main} thrown in D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\BundleEntryReader.php on line 175
致命错误:
文件:D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\BundleEntryReader.php
行数:175
消息:Uncaught Symfony\Component\Intl\Exception\ResourceBundleNotFoundException: The resource bundle "D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl/Resources/data/locales/root.php" does not exist. in D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\PhpBundleReader.php:38
Stack trace:
#0 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\BufferedBundleReader.php(46): Symfony\Component\Intl\Data\Bundle\Reader\PhpBundleReader->read('D:\\wwwroot\\dev-...', 'root')
#1 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\BundleEntryReader.php(88): Symfony\Component\Intl\Data\Bundle\Reader\BufferedBundleReader->read('D:\\wwwroot\\dev-...', 'root')
#2 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\ResourceBundle.php(58): Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader->readEntry('D:\\wwwroot\\dev-...', 'zh_CN', Array, true)
#3 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Locales.php(57): Symfony\Component\Intl\ResourceBundle::readEntry(Array, NULL)
#4 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\I18n\Controller\Backend\Countries\Locales.php(54): Symfony\Component\Intl\Locales::getName('yue_Hans_CN')
#5 [internal function]: Weline\I18n\Controller\Backend\Countries\Locales->install()
#6 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Router\Core.php(352): call_user_func(Array)
#7 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Router\Core.php(99): Weline\Framework\Router\Core->route()
#8 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(152): Weline\Framework\Router\Core->start()
#9 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(125): Weline\Framework\Router\Core\Interceptor->___callParentMethod('start', Array)
#10 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(144): Weline\Framework\Router\Core\Interceptor->Weline\Framework\Interception\{closure}()
#11 D:\wwwroot\dev-bbs.aiweline.com\generated\code\Weline\Framework\Router\Core\Interceptor.php(36): Weline\Framework\Router\Core\Interceptor->___callPlugins('start', Array, Array)
#12 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\App.php(203): Weline\Framework\Router\Core\Interceptor->start()
#13 D:\wwwroot\dev-bbs.aiweline.com\app\bootstrap.php(42): Weline\Framework\App::run()
#14 D:\wwwroot\dev-bbs.aiweline.com\pub\index.php(11): require('D:\\wwwroot\\dev-...')
#15 {main}
Next Symfony\Component\Intl\Exception\MissingResourceException: Couldn't read the indices [Names][yue_Hans_CN] for the locale "zh_CN" in "D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl/Resources/data/locales". The indices also couldn't be found for the fallback locale(s) "zh_Hans", "zh", "en", "root". in D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Data\Bundle\Reader\BundleEntryReader.php:175
Stack trace:
#0 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\ResourceBundle.php(58): Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader->readEntry('D:\\wwwroot\\dev-...', 'zh_CN', Array, true)
#1 D:\wwwroot\dev-bbs.aiweline.com\vendor\symfony\intl\Locales.php(57): Symfony\Component\Intl\ResourceBundle::readEntry(Array, NULL)
#2 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\I18n\Controller\Backend\Countries\Locales.php(54): Symfony\Component\Intl\Locales::getName('yue_Hans_CN')
#3 [internal function]: Weline\I18n\Controller\Backend\Countries\Locales->install()
#4 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Router\Core.php(352): call_user_func(Array)
#5 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Router\Core.php(99): Weline\Framework\Router\Core->route()
#6 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(152): Weline\Framework\Router\Core->start()
#7 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(125): Weline\Framework\Router\Core\Interceptor->___callParentMethod('start', Array)
#8 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\Interception\Interceptor.php(144): Weline\Framework\Router\Core\Interceptor->Weline\Framework\Interception\{closure}()
#9 D:\wwwroot\dev-bbs.aiweline.com\generated\code\Weline\Framework\Router\Core\Interceptor.php(36): Weline\Framework\Router\Core\Interceptor->___callPlugins('start', Array, Array)
#10 D:\wwwroot\dev-bbs.aiweline.com\app\code\Weline\Framework\App.php(203): Weline\Framework\Router\Core\Interceptor->start()
#11 D:\wwwroot\dev-bbs.aiweline.com\app\bootstrap.php(42): Weline\Framework\App::run()
#12 D:\wwwroot\dev-bbs.aiweline.com\pub\index.php(11): require('D:\\wwwroot\\dev-...')
#13 {main}
thrown