コード例 #1
0
ファイル: LoadLocaleData.php プロジェクト: pguso/WellCommerce
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $currency = $this->getReference('currency_USD');
     $en = new Locale();
     $en->setCode('en');
     $en->setCurrency($currency);
     $manager->persist($en);
     $manager->flush();
     $this->setReference('locale_en', $en);
 }
コード例 #2
0
 /**
  * Returns parsed translations from filesystem
  *
  * @param Locale $locale
  */
 protected function getFilesystemTranslationsForLocale(Locale $locale)
 {
     $filename = sprintf('wellcommerce.%s.yml', $locale->getCode());
     $filesystem = $this->getFilesystem();
     $path = $this->getFilesystemTranslationsPath() . DIRECTORY_SEPARATOR . $filename;
     if ($filesystem->exists($path)) {
         return $this->parseYaml($path);
     }
     return [];
 }
コード例 #3
0
 /**
  * Returns category slug
  *
  * @param Locale $locale
  * @param string $categoryName
  *
  * @return mixed|string
  */
 protected function getLocaleSlug(Locale $locale, $categoryName)
 {
     $slug = Sluggable::makeSlug($categoryName);
     $currentLocale = $this->getRequestHelper()->getCurrentLocale();
     if ($locale->getCode() != $currentLocale) {
         $slug = Sluggable::makeSlug(sprintf('%s-%s', $categoryName, $locale->getCode()));
     }
     return $slug;
 }