├── .github ├── CODE_OF_CONDUCT.md └── CONTRIBUTING.md ├── .gitignore ├── COPYING.txt ├── ConfigurablePdfFont ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ ├── Config │ │ ├── FontConfig.php │ │ └── Source │ │ │ └── Font.php │ ├── Filesystem │ │ ├── Directory │ │ │ └── ReadFactory.php │ │ ├── File │ │ │ └── Read.php │ │ └── FontFilesRewriter.php │ ├── Font.php │ ├── FontFile.php │ └── FontProvider.php ├── README.md ├── composer.json ├── etc │ ├── adminhtml │ │ └── system.xml │ ├── config.xml │ ├── di.xml │ └── module.xml ├── i18n │ └── ja_JP.csv └── registration.php ├── CurrencyPrecision ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ ├── Config │ │ ├── CurrencyRoundingConfig.php │ │ └── Source │ │ │ └── RoundingMode.php │ └── CurrencyRounding.php ├── Observer │ └── AdjustCurrencyPrecision.php ├── Plugin │ ├── Directory │ │ └── Model │ │ │ ├── CurrencyPrecisionFormatting.php │ │ │ └── CurrencyRounding.php │ └── Locale │ │ └── LocalizedFormat.php ├── README.md ├── Test │ └── Unit │ │ └── Model │ │ └── CurrencyRoundingTest.php ├── composer.json ├── etc │ ├── adminhtml │ │ └── system.xml │ ├── config.xml │ ├── di.xml │ ├── events.xml │ └── module.xml ├── i18n │ └── ja_JP.csv └── registration.php ├── FontIpa ├── LICENSE.txt ├── README.md ├── composer.json ├── etc │ ├── di.xml │ └── module.xml ├── i18n │ └── ja_JP.csv ├── lib │ └── fonts │ │ ├── ipag.ttf │ │ ├── ipagp.ttf │ │ ├── ipam.ttf │ │ └── ipamp.ttf └── registration.php ├── FontSourceHanSansJapanese ├── LICENSE.txt ├── README.md ├── composer.json ├── etc │ ├── config.xml │ ├── di.xml │ └── module.xml ├── i18n │ └── ja_JP.csv ├── lib │ └── fonts │ │ ├── SourceHanSansJP-Bold.ttf │ │ └── SourceHanSansJP-Regular.ttf └── registration.php ├── JapaneseAddress ├── Block │ └── Checkout │ │ ├── BillingAddressComponent.php │ │ └── CountryFieldVisibility.php ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ ├── Config │ │ ├── CountryInputConfig.php │ │ └── CustomerRegistrationConfig.php │ └── Db │ │ └── Sql │ │ └── ConditionalConcatExpression.php ├── Plugin │ ├── Customer │ │ ├── Block │ │ │ └── Form │ │ │ │ ├── CountryFieldVisibility.php │ │ │ │ ├── RegisterWithAddress.php │ │ │ │ └── RegisterWithQuoteAddress.php │ │ ├── Helper │ │ │ └── Name.php │ │ └── Model │ │ │ ├── Name.php │ │ │ └── ResourceModel │ │ │ └── Customer │ │ │ └── Collection │ │ │ └── Name.php │ ├── Reports │ │ └── Order │ │ │ └── Collection │ │ │ └── Name.php │ ├── Sales │ │ └── Model │ │ │ └── Order │ │ │ ├── Address │ │ │ └── Name.php │ │ │ └── CustomerName.php │ └── Ui │ │ └── View │ │ └── Element │ │ └── PartiallyConfiguredUiComponent.php ├── README.md ├── Setup │ └── Patch │ │ └── Data │ │ └── AddressAttributesOrder.php ├── composer.json ├── etc │ ├── adminhtml │ │ └── system.xml │ ├── config.xml │ ├── di.xml │ ├── frontend │ │ └── di.xml │ └── module.xml ├── i18n │ └── ja_JP.csv ├── registration.php └── view │ ├── adminhtml │ ├── requirejs-config.js │ └── web │ │ ├── js │ │ └── address-preview.js │ │ └── template │ │ └── address-preview.html │ ├── base │ └── ui_component │ │ ├── customer_address_form.xml │ │ └── customer_form.xml │ └── frontend │ ├── layout │ ├── checkout_index_index.xml │ ├── customer_account_create.xml │ ├── customer_address_form.xml │ └── multishipping_checkout_customer_address.xml │ ├── requirejs-config.js │ ├── templates │ ├── account │ │ └── register.phtml │ └── address │ │ └── edit.phtml │ └── web │ ├── js │ └── postcode-validation-fix.js │ └── template │ ├── checkout-address-search │ ├── billing-address │ │ ├── address-renderer │ │ │ └── jp.html │ │ └── jp.html │ └── shipping-address │ │ ├── address-renderer │ │ └── jp.html │ │ └── jp.html │ └── checkout │ ├── billing-address.html │ ├── billing-address │ └── details.html │ ├── shipping-address │ └── address-renderer │ │ └── jp.html │ └── shipping-information │ └── address-renderer │ └── jp.html ├── JapaneseDefaultCmsPages ├── LICENSE.txt ├── LICENSE_AFL.txt ├── README.md ├── Setup │ └── Patch │ │ └── Data │ │ └── DefaultPagesTranslations.php ├── composer.json ├── etc │ └── module.xml ├── i18n │ ├── ja_JP.csv │ └── ja_JP │ │ ├── enable-cookies.html │ │ ├── home.html │ │ ├── no-route.html │ │ └── privacy-policy-cookie-restriction-mode.html └── registration.php ├── JapaneseDefaultConfig ├── LICENSE.txt ├── LICENSE_AFL.txt ├── README.md ├── composer.json ├── etc │ ├── config.xml │ ├── db_schema.xml │ └── module.xml └── registration.php ├── JapaneseName ├── Block │ ├── Checkout │ │ └── KanaFieldsProcessor.php │ └── KanaFormViewModel.php ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ ├── Config │ │ ├── KanaFieldsConfig.php │ │ └── Source │ │ │ └── Kana.php │ └── DataObject │ │ └── Copy.php ├── Observer │ ├── Quote │ │ ├── QuoteAddressKanaFieldsCleaning.php │ │ ├── QuoteAddressKanaFieldsLoader.php │ │ ├── QuoteAddressKanaFieldsSaver.php │ │ ├── QuoteKanaFieldsCleaning.php │ │ ├── QuoteKanaFieldsLoader.php │ │ └── QuoteKanaFieldsSaver.php │ └── Sales │ │ ├── OrderAddressKanaFieldsCleaning.php │ │ ├── OrderAddressKanaFieldsLoader.php │ │ ├── OrderAddressKanaFieldsSaver.php │ │ ├── OrderKanaFieldsCleaning.php │ │ ├── OrderKanaFieldsLoader.php │ │ └── OrderKanaFieldsSaver.php ├── Plugin │ ├── Customer │ │ ├── Block │ │ │ ├── Account │ │ │ │ └── Dashboard │ │ │ │ │ └── InfoNameKana.php │ │ │ ├── Address │ │ │ │ ├── Edit │ │ │ │ │ └── CopyKanaToNewAddress.php │ │ │ │ └── KanaAttributesRenderer.php │ │ │ └── Widget │ │ │ │ └── Name.php │ │ └── Model │ │ │ ├── Delegation │ │ │ └── NewOperationNormalization.php │ │ │ └── Metadata │ │ │ └── KanaAttributesInjection.php │ ├── Framework │ │ └── Data │ │ │ └── ExtensionAttributesValues.php │ └── Quote │ │ └── Model │ │ └── Quote │ │ └── ExportAddressKana.php ├── README.md ├── Setup │ └── Patch │ │ └── Data │ │ └── KanaAttributes.php ├── composer.json ├── etc │ ├── adminhtml │ │ └── system.xml │ ├── config.xml │ ├── db_schema.xml │ ├── di.xml │ ├── events.xml │ ├── extension_attributes.xml │ ├── fieldset.xml │ ├── frontend │ │ └── di.xml │ ├── indexer.xml │ └── module.xml ├── i18n │ └── ja_JP.csv ├── registration.php └── view │ ├── adminhtml │ └── ui_component │ │ └── customer_listing.xml │ └── frontend │ ├── requirejs-config.js │ ├── templates │ └── customer │ │ └── widget │ │ └── name.phtml │ └── web │ └── js │ ├── address │ └── kana-accessors.js │ ├── checkout │ └── action │ │ └── set-addresses-information.js │ └── validation.js ├── JapanesePostalCode ├── LICENSE.txt ├── LICENSE_AFL.txt ├── README.md ├── composer.json ├── etc │ ├── csp_whitelist.xml │ └── module.xml ├── i18n │ └── ja_JP.csv ├── registration.php └── view │ └── frontend │ ├── layout │ ├── customer_account_create.xml │ ├── customer_address_form.xml │ └── multishipping_checkout_customer_address.xml │ ├── requirejs-config.js │ ├── templates │ └── address_updater_widget_binding.phtml │ └── web │ └── js │ ├── service │ └── madefor-postal-code-api.js │ ├── ui │ └── form-postal-code-element.js │ └── widget │ └── address-updater.js ├── JapaneseRegion ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ └── ResourceModel │ │ └── Directory │ │ └── Region │ │ └── Collection.php ├── README.md ├── Setup │ └── Patch │ │ └── Data │ │ └── AddDataForJapan.php ├── Test │ └── Unit │ │ └── Model │ │ └── ResourceModel │ │ └── Directory │ │ └── Region │ │ └── CollectionTest.php ├── composer.json ├── etc │ ├── di.xml │ └── module.xml ├── i18n │ └── ja_JP.csv └── registration.php ├── JapaneseStoreAddress ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ └── Config │ │ └── StoreAddressConfig.php ├── Plugin │ └── Store │ │ └── Model │ │ └── Address │ │ └── Renderer.php ├── README.md ├── composer.json ├── etc │ ├── adminhtml │ │ └── system.xml │ ├── config.xml │ ├── di.xml │ └── module.xml ├── i18n │ └── ja_JP.csv └── registration.php ├── JapaneseUrlRewrite ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ └── Transliterator.php ├── Plugin │ └── Filter │ │ ├── Translit.php │ │ └── TranslitUrl.php ├── README.md ├── composer.json ├── etc │ ├── di.xml │ └── module.xml └── registration.php ├── JapaneseYenFormatting ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ ├── Config │ │ ├── Source │ │ │ └── YenFormatting.php │ │ └── YenFormattingConfig.php │ └── CurrencyFormatOptionModifiers.php ├── Observer │ └── ModifyCurrencyFormattingOptions.php ├── Plugin │ └── Directory │ │ └── Model │ │ └── YenFormatting.php ├── README.md ├── composer.json ├── etc │ ├── adminhtml │ │ └── system.xml │ ├── config.xml │ ├── di.xml │ ├── events.xml │ └── module.xml ├── i18n │ └── ja_JP.csv └── registration.php ├── Kuromoji ├── LICENSE.txt ├── LICENSE_AFL.txt ├── Model │ └── ElasticSearch │ │ └── Adapter │ │ └── Index │ │ └── Builder.php ├── README.md ├── SearchAdapter │ └── Query │ │ └── Builder │ │ └── Aggregation.php ├── composer.json ├── etc │ ├── di.xml │ └── module.xml └── registration.php ├── LICENSE.txt ├── LICENSE_AFL.txt ├── README.md ├── _metapackage ├── LICENSE.txt ├── LICENSE_AFL.txt ├── README.md └── composer.json └── _phrases ├── LICENSE.txt ├── LICENSE_AFL.txt ├── README.md ├── composer.json ├── ja_JP.csv ├── language.xml └── registration.php /.gitignore: -------------------------------------------------------------------------------- 1 | /.buildpath 2 | /.cache 3 | /.metadata 4 | /.project 5 | /.settings 6 | atlassian* 7 | /nbproject 8 | /.idea 9 | /.gitattributes 10 | .DS_Store 11 | -------------------------------------------------------------------------------- /COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2013-present Magento, Inc. 2 | 3 | Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license 4 | 5 | http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 6 | Please see LICENSE.txt for the full text of the OSL 3.0 license or contact license@magentocommerce.com for a copy. 7 | 8 | Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file. 9 | Please see LICENSE_EE.txt for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise. 10 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/LICENSE_AFL.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/ConfigurablePdfFont/LICENSE_AFL.txt -------------------------------------------------------------------------------- /ConfigurablePdfFont/Model/Config/FontConfig.php: -------------------------------------------------------------------------------- 1 | config = $config; 46 | $this->fontProvider = $fontProvider; 47 | } 48 | 49 | /** 50 | * Get font selected by admin. 51 | * 52 | * @return Font 53 | */ 54 | public function getActiveFont(): Font 55 | { 56 | $fontCode = $this->config->getValue('general/pdf/font'); 57 | $font = $this->fontProvider->getFont($fontCode); 58 | return $font; 59 | } 60 | 61 | /** 62 | * Get default system font. 63 | * 64 | * @return Font 65 | */ 66 | public function getDefaultFont(): Font 67 | { 68 | $font = $this->fontProvider->getFont(self::DEFAULT_FONT_CODE); 69 | return $font; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/Model/Config/Source/Font.php: -------------------------------------------------------------------------------- 1 | fontProvider = $fontProvider; 29 | } 30 | 31 | /** 32 | * @inheritdoc 33 | */ 34 | public function toOptionArray() 35 | { 36 | $fonts = []; 37 | foreach ($this->fontProvider->getFonts() as $fontCode => $font) { 38 | $fonts[$fontCode] = $font->getName(); 39 | } 40 | return $fonts; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/Model/Filesystem/Directory/ReadFactory.php: -------------------------------------------------------------------------------- 1 | driverPool = $driverPool; 34 | parent::__construct($driverPool); 35 | } 36 | 37 | /** 38 | * @inheritdoc 39 | */ 40 | public function create($path, $driverCode = DriverPool::FILE) 41 | { 42 | $driver = $this->driverPool->getDriver($driverCode); 43 | $factory = new FileReadFactory($this->driverPool); 44 | 45 | return new Read( 46 | $factory, 47 | $driver, 48 | $path, 49 | new PathValidator($driver), 50 | ObjectManager::getInstance()->get(FontFilesRewriter::class) 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/Model/Filesystem/File/Read.php: -------------------------------------------------------------------------------- 1 | filesRewriter = $filesRewriter; 43 | } 44 | 45 | /** 46 | * Override path resolution for build-in fonts with JP fonts when needed. 47 | * 48 | * @param string $path 49 | * @param string $scheme 50 | * @return string 51 | * @throws \Magento\Framework\Exception\ValidatorException 52 | */ 53 | public function getAbsolutePath($path = null, $scheme = null) 54 | { 55 | $path = $this->filesRewriter->rewrite($path); 56 | return parent::getAbsolutePath($path, $scheme); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/Model/Filesystem/FontFilesRewriter.php: -------------------------------------------------------------------------------- 1 | componentRegistrar = $componentRegistrar; 44 | $this->fontConfig = $fontConfig; 45 | } 46 | 47 | /** 48 | * @inheritdoc 49 | */ 50 | public function rewrite(string $path): string 51 | { 52 | if (!isset($this->handler)) { 53 | $this->handler = $this->createRewriteHandler(); 54 | } 55 | 56 | $handler = $this->handler; 57 | $rewrittenPath = $handler($path); 58 | return $rewrittenPath; 59 | } 60 | 61 | /** 62 | * Create rewrite handler based on configuration. 63 | * 64 | * @return \Closure 65 | */ 66 | private function createRewriteHandler(): \Closure 67 | { 68 | $defaultFont = $this->fontConfig->getDefaultFont(); 69 | $activeFont = $this->fontConfig->getActiveFont(); 70 | if ($activeFont === $defaultFont) { 71 | return function ($path) { 72 | return $path; 73 | }; 74 | } 75 | 76 | $map = [ 77 | $defaultFont->getRegular() => $activeFont->getRegular(), 78 | $defaultFont->getBold() => $activeFont->getBold(), 79 | $defaultFont->getItalic() => $activeFont->getItalic(), 80 | ]; 81 | return function ($path) use ($map) { 82 | if (isset($map[$path])) { 83 | return $map[$path]; 84 | } 85 | return $path; 86 | }; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/Model/Font.php: -------------------------------------------------------------------------------- 1 | name = $data['name']; 56 | $this->regular = $data['regular']; 57 | $this->bold = $data['bold'] ?? null; 58 | $this->italic = $data['italic'] ?? null; 59 | } 60 | 61 | /** 62 | * Get human readable font name 63 | * 64 | * @return string 65 | */ 66 | public function getName(): string 67 | { 68 | return $this->name; 69 | } 70 | 71 | /** 72 | * Get path to regular font file 73 | * 74 | * @return string 75 | */ 76 | public function getRegular(): string 77 | { 78 | return $this->regular->getPath(); 79 | } 80 | 81 | /** 82 | * Get path to bold font file 83 | * 84 | * @return string 85 | */ 86 | public function getBold(): string 87 | { 88 | return $this->bold ? $this->bold->getPath() : $this->getRegular(); 89 | } 90 | 91 | /** 92 | * Get path to italic font file 93 | * 94 | * @return string 95 | */ 96 | public function getItalic(): string 97 | { 98 | return $this->italic ? $this->italic->getPath() : $this->getRegular(); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/Model/FontProvider.php: -------------------------------------------------------------------------------- 1 | fonts = $fonts; 28 | } 29 | 30 | /** 31 | * Get list of all available fonts. 32 | * 33 | * @return Font[] 34 | */ 35 | public function getFonts(): array 36 | { 37 | return $this->fonts; 38 | } 39 | 40 | /** 41 | * Check if font is available. 42 | * 43 | * @param string $code 44 | * @return bool 45 | */ 46 | public function hasFont(string $code): bool 47 | { 48 | return isset($this->fonts[$code]); 49 | } 50 | 51 | /** 52 | * Fetch font by code. 53 | * 54 | * @param string $code 55 | * @return Font 56 | * @throws \OutOfBoundsException if font is not registered. 57 | */ 58 | public function getFont(string $code): Font 59 | { 60 | if (!$this->hasFont($code)) { 61 | throw new \OutOfBoundsException(sprintf('Unknown font requested "%s".', $code)); 62 | } 63 | return $this->fonts[$code]; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/README.md: -------------------------------------------------------------------------------- 1 | Module provides possibility to specify fonts to use during PDF files generation. 2 | 3 | Module does not contain files because of licensing. See `Magento_JapanSourceHanSansJapanese` for font files provided under under SIL OPEN FONT LICENSE Version 1.1. -------------------------------------------------------------------------------- /ConfigurablePdfFont/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-configurable-pdf-font", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension for Japanese Pdf Fonts.", 10 | "require": { 11 | "php": "~7.1.3||~7.2.0||~7.3.0", 12 | "magento/framework": "^102.0.0" 13 | }, 14 | "suggest": { 15 | "magento/module-sales": "^102.0.0" 16 | }, 17 | "autoload": { 18 | "files": [ 19 | "registration.php" 20 | ], 21 | "psr-4": { 22 | "CommunityEngineering\\ConfigurablePdfFont\\": "" 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/etc/adminhtml/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | CommunityEngineering\ConfigurablePdfFont\Model\Config\Source\Font 16 | general/pdf/font 17 | 18 | 19 |
20 |
21 |
22 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | default 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | \CommunityEngineering\ConfigurablePdfFont\Model\Filesystem\Directory\ReadFactory 13 | 14 | 15 | 16 | 17 | 18 | CommunityEngineering\ConfigurablePdfFont\Model\Filesystem 19 | 20 | 21 | 22 | 23 | 24 | 25 | DefaultFont 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Default (Free Serif Fonts) 34 | FreeSerifRegular 35 | FreeSerifBold 36 | FreeSerifItalic 37 | 38 | 39 | 40 | 41 | 42 | lib/internal/GnuFreeFont/FreeSerif.ttf 43 | 44 | 45 | 46 | 47 | lib/internal/GnuFreeFont/FreeSerifBold.ttf 48 | 49 | 50 | 51 | 52 | lib/internal/GnuFreeFont/FreeSerifItalic.ttf 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Font","フォント" 2 | "Default (Free Serif Fonts)","デフォルト (Free Serif Fonts)" 3 | -------------------------------------------------------------------------------- /ConfigurablePdfFont/registration.php: -------------------------------------------------------------------------------- 1 | scopeConfig = $scopeConfig; 30 | } 31 | 32 | /** 33 | * Return configured rounding mode for currencies. 34 | * 35 | * @return string 36 | */ 37 | public function getRoundingMode(): string 38 | { 39 | $configuredVale = $this->scopeConfig->getValue( 40 | 'currency/options/rounding_mode', 41 | ScopeInterface::SCOPE_WEBSITE 42 | ); 43 | return $configuredVale; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /CurrencyPrecision/Observer/AdjustCurrencyPrecision.php: -------------------------------------------------------------------------------- 1 | currencyRounding = $currencyRounding; 31 | } 32 | 33 | /** 34 | * @inheritdoc 35 | */ 36 | public function execute(Observer $observer) 37 | { 38 | $event = $observer->getEvent(); 39 | $currencyCode = $event->getData('base_code'); 40 | $currencyOptions = $event->getData('currency_options'); 41 | 42 | if ($currencyCode !== null) { 43 | $currencyOptions->addData($this->getPrecisionOptions($currencyCode)); 44 | } 45 | 46 | return $this; 47 | } 48 | 49 | /** 50 | * Get options to configure required precision. 51 | * 52 | * @param string $currencyCode 53 | * @return array 54 | */ 55 | private function getPrecisionOptions(string $currencyCode): array 56 | { 57 | return [ 58 | 'precision' => $this->currencyRounding->getPrecision($currencyCode) 59 | ]; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CurrencyPrecision/Plugin/Directory/Model/CurrencyPrecisionFormatting.php: -------------------------------------------------------------------------------- 1 | currencyRounding = $currencyRounding; 32 | } 33 | 34 | /** 35 | * Override requested precision to use system defined precision. 36 | * 37 | * Only Currency::formatTxt should be pluginized as all other formatting methods should use its result. 38 | * 39 | * @param Currency $currency 40 | * @param float|string $price 41 | * @param array $options 42 | * @return array 43 | */ 44 | public function beforeFormatTxt( 45 | Currency $currency, 46 | $price, 47 | $options = [] 48 | ) { 49 | //round before formatting to apply configured rounding mode. 50 | if ($currency->getCode() !== null) { 51 | $price = $this->currencyRounding->round($currency->getCode(), (float)$price); 52 | $options['precision'] = $this->currencyRounding->getPrecision($currency->getCode()); 53 | } 54 | return [$price, $options]; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /CurrencyPrecision/Plugin/Locale/LocalizedFormat.php: -------------------------------------------------------------------------------- 1 | localeResolver = $localeResolver; 29 | } 30 | 31 | /** 32 | * Parse number with locale-aware parser. 33 | * 34 | * @param Format $format 35 | * @param mixed $value 36 | * @return array 37 | * 38 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 39 | */ 40 | public function beforeGetNumber(Format $format, $value) 41 | { 42 | if (!is_string($value)) { 43 | return [$value]; 44 | } 45 | 46 | $formatter = new \NumberFormatter($this->localeResolver->getLocale(), \NumberFormatter::DECIMAL); 47 | $number = $formatter->parse($value); 48 | return [(string)$number]; // trigger core logic with dot handling for backward compatibility 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CurrencyPrecision/README.md: -------------------------------------------------------------------------------- 1 | Module adds more accurate handling of currencies precision so currencies will be always rounded to minor subunits precision. 2 | 3 | Currency precisions are nto configurable and data from intl library are used. 4 | -------------------------------------------------------------------------------- /CurrencyPrecision/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-currency-precision", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension for Price.", 10 | "authors":[ 11 | { 12 | "name": "Hirokazu Nishi", 13 | "email": "nishi@veriteworks.co.jp", 14 | "homepage": "https://veriteworks.co.jp/", 15 | "role": "developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "~7.1.3||~7.2.0||~7.3.0", 20 | "magento/framework": "^102.0.0", 21 | "magento/module-store": "^101.0.0", 22 | "magento/module-directory": "^100.3.0" 23 | }, 24 | "autoload": { 25 | "files": [ 26 | "registration.php" 27 | ], 28 | "psr-4": { 29 | "CommunityEngineering\\CurrencyPrecision\\": "" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CurrencyPrecision/etc/adminhtml/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | CommunityEngineering\CurrencyPrecision\Model\Config\Source\RoundingMode 15 | currency/options/rounding_mode 16 | 17 | 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /CurrencyPrecision/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | down 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /CurrencyPrecision/etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CurrencyPrecision/etc/events.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /CurrencyPrecision/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /CurrencyPrecision/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Up","切り上げ" 2 | " (round away from zero)"," (0から離れた数値へ丸め)" 3 | "Ceiling","切り上げ" 4 | " (round towards positive infinity)"," (最も大きな整数になるように丸め)" 5 | "Down","切り捨て" 6 | " (round towards zero)"," (小数点以下を0に丸め)" 7 | "Floor","切り捨て" 8 | " (round towards negative infinity)"," (最も小さな整数になるように丸め)" 9 | "Half Down","五捨六入" 10 | " (round towards ""nearest neighbor"" unless both neighbors are equidistant, in which case "," (""最も近い"" 整数へ丸める。両方の整数が等距離にある場合、端数を" 11 | "round down)","切り捨てる)" 12 | "Half Even","偶数丸め" 13 | "round towards the even neighbor)","最も近い偶数へ丸める)" 14 | "Half Up","四捨五入" 15 | "round up)","切り上げる)" 16 | "Currency Rounding Method","端数丸め処理" 17 | "Configured rounding mode ""%s"" is not implemented.","設定された端数処理方法 ""%s"" は未実装です。" -------------------------------------------------------------------------------- /CurrencyPrecision/registration.php: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /FontIpa/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "IPA Gothic","IPAゴシック" 2 | "IPA P Gothic","IPA Pゴシック" 3 | "IPA Mincho","IPA明朝" 4 | "IPA P Mincho","IPA P明朝" 5 | -------------------------------------------------------------------------------- /FontIpa/lib/fonts/ipag.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/FontIpa/lib/fonts/ipag.ttf -------------------------------------------------------------------------------- /FontIpa/lib/fonts/ipagp.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/FontIpa/lib/fonts/ipagp.ttf -------------------------------------------------------------------------------- /FontIpa/lib/fonts/ipam.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/FontIpa/lib/fonts/ipam.ttf -------------------------------------------------------------------------------- /FontIpa/lib/fonts/ipamp.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/FontIpa/lib/fonts/ipamp.ttf -------------------------------------------------------------------------------- /FontIpa/registration.php: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | source_han_sans_japanese 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /FontSourceHanSansJapanese/etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | SourceHanSansJapaneseFont 13 | 14 | 15 | 16 | 17 | 18 | 19 | Source Han Sans Japanese 20 | SourceHanSansJapaneseRegular 21 | SourceHanSansJapaneseBold 22 | 23 | 24 | 25 | 26 | 27 | CommunityEngineering_FontSourceHanSansJapanese::SourceHanSansJP-Regular.ttf 28 | 29 | 30 | 31 | 32 | CommunityEngineering_FontSourceHanSansJapanese::SourceHanSansJP-Bold.ttf 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /FontSourceHanSansJapanese/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /FontSourceHanSansJapanese/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Source Han Sans Japanese","源ノ角ゴシック" 2 | -------------------------------------------------------------------------------- /FontSourceHanSansJapanese/lib/fonts/SourceHanSansJP-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/FontSourceHanSansJapanese/lib/fonts/SourceHanSansJP-Bold.ttf -------------------------------------------------------------------------------- /FontSourceHanSansJapanese/lib/fonts/SourceHanSansJP-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/FontSourceHanSansJapanese/lib/fonts/SourceHanSansJP-Regular.ttf -------------------------------------------------------------------------------- /FontSourceHanSansJapanese/registration.php: -------------------------------------------------------------------------------- 1 | countryFieldConfig = $countryFieldConfig; 29 | } 30 | 31 | /** 32 | * @inheritdoc 33 | */ 34 | public function process($jsLayout) 35 | { 36 | if (!isset($jsLayout['components']['checkout']['children']['steps'])) { 37 | return $jsLayout; 38 | } 39 | 40 | $jsLayout['components']['checkout']['children']['steps'] = $this->walkChildren( 41 | $jsLayout['components']['checkout']['children']['steps'] 42 | ); 43 | 44 | return $jsLayout; 45 | } 46 | 47 | /** 48 | * Walk though components and modify visibility of all country components. 49 | * 50 | * @param array $component 51 | * @return array 52 | */ 53 | private function walkChildren(array $component): array 54 | { 55 | if (!isset($component['children']) || !is_array($component['children'])) { 56 | return $component; 57 | } 58 | 59 | foreach ($component['children'] as $name => $child) { 60 | if ($name === 'country_id') { 61 | $component['children'][$name]['visible'] = $this->countryFieldConfig->isVisibleAtStorefront(); 62 | } else { 63 | $component['children'][$name] = $this->walkChildren($child); 64 | } 65 | } 66 | return $component; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /JapaneseAddress/Model/Config/CountryInputConfig.php: -------------------------------------------------------------------------------- 1 | config = $config; 29 | } 30 | 31 | /** 32 | * Determine if country field should be present at storefront address forms. 33 | * 34 | * @return bool 35 | */ 36 | public function isVisibleAtStorefront(): bool 37 | { 38 | $configValue = $this->config->getValue('customer/address/country_show', ScopeInterface::SCOPE_STORE); 39 | return (bool)$configValue; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /JapaneseAddress/Model/Config/CustomerRegistrationConfig.php: -------------------------------------------------------------------------------- 1 | config = $config; 29 | } 30 | 31 | /** 32 | * Determine if address data should be requested during customer registration. 33 | * 34 | * @return bool 35 | */ 36 | public function isAddressRequired(): bool 37 | { 38 | $configValue = $this->config->getValue('customer/create_account/request_address', ScopeInterface::SCOPE_STORE); 39 | return (bool)$configValue; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Customer/Block/Form/CountryFieldVisibility.php: -------------------------------------------------------------------------------- 1 | countryFieldConfig = $countryFieldConfig; 29 | } 30 | 31 | /** 32 | * Modify HTML with country field after block rendering. 33 | * 34 | * @param AbstractBlock $block 35 | * @param string $html 36 | * @return mixed 37 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 38 | */ 39 | public function afterToHtml(AbstractBlock $block, $html) 40 | { 41 | if ($this->countryFieldConfig->isVisibleAtStorefront()) { 42 | return $html; 43 | } 44 | 45 | $hidingCssHack = 'style="display:none;visibility:hidden;height:0px;padding:0px;margin:0px;"'; 46 | $modifiedHtml = str_replace( 47 | 'class="field country required"', 48 | 'class="field country required" ' . $hidingCssHack, 49 | $html 50 | ); 51 | 52 | return $modifiedHtml; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Customer/Block/Form/RegisterWithAddress.php: -------------------------------------------------------------------------------- 1 | config = $config; 29 | } 30 | 31 | /** 32 | * Use config value if it does not defined at runtime. 33 | * 34 | * @param Register $form 35 | * @param mixed $result 36 | * @return mixed 37 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 38 | */ 39 | private function getShowAddressFields(Register $form, $result) 40 | { 41 | if ($result !== null) { 42 | return $result; 43 | } 44 | return $this->config->isAddressRequired(); 45 | } 46 | 47 | // @codingStandardsIgnoreStart 48 | /** 49 | * Puginize magic methods 50 | * 51 | * @param Register $form 52 | * @param mixed $result 53 | * @param string $method 54 | * @return mixed 55 | */ 56 | public function after__call(Register $form, $result, $method) 57 | { 58 | switch ($method) { 59 | case 'getShowAddressFields': 60 | return $this->getShowAddressFields($form, $result); 61 | default: 62 | return $result; 63 | } 64 | } 65 | // @codingStandardsIgnoreEnd 66 | } 67 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Customer/Block/Form/RegisterWithQuoteAddress.php: -------------------------------------------------------------------------------- 1 | getData('address_data_imported')) { 33 | return $data; 34 | } 35 | 36 | $data->setData('address_data_imported', true); 37 | 38 | $addresses = $data->getData('addresses'); 39 | if (!isset($addresses[0])) { 40 | return $data; 41 | } 42 | 43 | foreach ($addresses[0] as $key => $value) { 44 | if (!$data->hasData($key)) { 45 | if ($key === 'region' && is_array($value)) { 46 | $data->setData($key, $value['region']); 47 | } else { 48 | $data->setData($key, $value); 49 | } 50 | } 51 | } 52 | return $data; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Customer/Helper/Name.php: -------------------------------------------------------------------------------- 1 | localeResolver = $localeResolver; 39 | $this->customerMetadataService = $customerMetadataService; 40 | } 41 | 42 | /** 43 | * If enabled Japanese locale then last name should precede first name. 44 | * 45 | * @param View $subject 46 | * @param string $name 47 | * @param CustomerInterface $customerData 48 | * @return string 49 | * @throws \Magento\Framework\Exception\LocalizedException 50 | * @throws \Magento\Framework\Exception\NoSuchEntityException 51 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 52 | */ 53 | public function afterGetCustomerName( 54 | View $subject, 55 | string $name, 56 | CustomerInterface $customerData 57 | ) { 58 | // if($this->localeResolver->getLocale() != 'ja_JP') { 59 | // return $name; 60 | // } 61 | 62 | $name = ''; 63 | $prefixMetadata = $this->customerMetadataService->getAttributeMetadata('prefix'); 64 | if ($prefixMetadata->isVisible() && $customerData->getPrefix()) { 65 | $name .= $customerData->getPrefix() . ' '; 66 | } 67 | 68 | $name .= $customerData->getLastname(); 69 | 70 | $middleNameMetadata = $this->customerMetadataService->getAttributeMetadata('middlename'); 71 | if ($middleNameMetadata->isVisible() && $customerData->getMiddlename()) { 72 | $name .= ' ' . $customerData->getMiddlename(); 73 | } 74 | 75 | $name .= ' ' . $customerData->getFirstname(); 76 | 77 | $suffixMetadata = $this->customerMetadataService->getAttributeMetadata('suffix'); 78 | if ($suffixMetadata->isVisible() && $customerData->getSuffix()) { 79 | $name .= ' ' . $customerData->getSuffix(); 80 | } 81 | 82 | return $name; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Customer/Model/Name.php: -------------------------------------------------------------------------------- 1 | localeResolver = $localeResolver; 38 | $this->config = $config; 39 | } 40 | 41 | /** 42 | * If enabled Japanese locale then last name should precede first name. 43 | * 44 | * @param Customer $customer 45 | * @param string $name 46 | * @return string 47 | * @throws \Magento\Framework\Exception\LocalizedException 48 | */ 49 | public function afterGetName( 50 | Customer $customer, 51 | string $name 52 | ) { 53 | // if($this->localeResolver->getLocale() != 'ja_JP') { 54 | // return $name; 55 | // } 56 | 57 | $name = ''; 58 | if ($this->config->getAttribute('customer', 'prefix')->getIsVisible() 59 | && $customer->getPrefix() 60 | ) { 61 | $name .= $customer->getPrefix() . ' '; 62 | } 63 | $name .= $customer->getLastname(); 64 | if ($this->config->getAttribute('customer', 'middlename')->getIsVisible() 65 | && $customer->getMiddlename() 66 | ) { 67 | $name .= ' ' . $customer->getMiddlename(); 68 | } 69 | $name .= ' ' . $customer->getFirstname(); 70 | if ($this->config->getAttribute('customer', 'suffix')->getIsVisible() 71 | && $customer->getSuffix() 72 | ) { 73 | $name .= ' ' . $customer->getSuffix(); 74 | } 75 | return $name; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Reports/Order/Collection/Name.php: -------------------------------------------------------------------------------- 1 | localeResolver = $localeResolver; 38 | $this->nameSqlExpression = $nameSqlExpression; 39 | } 40 | 41 | /** 42 | * Use specific expression for japanese names in report. 43 | * 44 | * @param Collection $subject 45 | * @param \Closure $proceed 46 | * @param string $alias 47 | * @return Collection|mixed 48 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 49 | */ 50 | public function aroundJoinCustomerName( 51 | Collection $subject, 52 | \Closure $proceed, 53 | $alias = 'name' 54 | ) { 55 | // if($this->localeResolver->getLocale() != 'ja_JP') { 56 | // return $proceed($alias); 57 | // } 58 | 59 | $subject->getSelect()->columns([$alias => (string)$this->nameSqlExpression]); 60 | return $subject; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Sales/Model/Order/Address/Name.php: -------------------------------------------------------------------------------- 1 | localeResolver = $localeResolver; 30 | } 31 | 32 | /** 33 | * Build Japanese name. 34 | * 35 | * @param Address $address 36 | * @param string $name 37 | * @return string 38 | */ 39 | public function afterGetName( 40 | Address $address, 41 | string $name 42 | ) { 43 | // if($this->localeResolver->getLocale() != 'ja_JP') { 44 | // return $name; 45 | // } 46 | 47 | $name = ''; 48 | if ($address->getPrefix()) { 49 | $name .= $address->getPrefix() . ' '; 50 | } 51 | $name .= $address->getLastname(); 52 | if ($address->getMiddlename()) { 53 | $name .= ' ' . $address->getMiddlename(); 54 | } 55 | $name .= ' ' . $address->getFirstname(); 56 | if ($address->getSuffix()) { 57 | $name .= ' ' . $address->getSuffix(); 58 | } 59 | 60 | $extensions = $address->getExtensionAttributes(); 61 | if ($extensions === null) { 62 | return $name; 63 | } 64 | 65 | $namekana = trim(sprintf('%s %s', $extensions->getLastnamekana(), $extensions->getFirstnamekana())); 66 | if ($namekana !== '') { 67 | $name = sprintf('%s (%s)', $name, $namekana); 68 | } 69 | 70 | return $name; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Sales/Model/Order/CustomerName.php: -------------------------------------------------------------------------------- 1 | localeResolver = $localeResolver; 30 | } 31 | 32 | /** 33 | * Build Japanese name. 34 | * 35 | * @param Order $order 36 | * @param string $customerName 37 | * @return string 38 | */ 39 | public function afterGetCustomerName( 40 | Order $order, 41 | string $customerName 42 | ) { 43 | // if($this->localeResolver->getLocale() != 'ja_JP') { 44 | // return $customerName; 45 | // } 46 | 47 | if (!$order->getCustomerLastname()) { 48 | return (string)__('Guest'); 49 | } 50 | 51 | $customerName = sprintf( 52 | '%s %s', 53 | $order->getCustomerLastname(), 54 | $order->getCustomerFirstname() 55 | ); 56 | 57 | $extensions = $order->getExtensionAttributes(); 58 | if ($extensions === null) { 59 | return $customerName; 60 | } 61 | 62 | $customerNamekana = sprintf( 63 | '%s %s', 64 | $extensions->getCustomerLastnamekana(), 65 | $extensions->getCustomerFirstnamekana() 66 | ); 67 | if (!empty(trim($customerNamekana))) { 68 | $customerName = sprintf('%s (%s)', $customerName, $customerNamekana); 69 | } 70 | 71 | return $customerName; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /JapaneseAddress/Plugin/Ui/View/Element/PartiallyConfiguredUiComponent.php: -------------------------------------------------------------------------------- 1 | $child) { 36 | if ($child instanceof Field && null === $child->getData('config/formElement')) { 37 | continue; 38 | } 39 | $configuredChildren[$key] = $child; 40 | } 41 | return $configuredChildren; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /JapaneseAddress/README.md: -------------------------------------------------------------------------------- 1 | This module changes fields order at customer and address forms and full customer name address formats to correspond with Japan traditions. -------------------------------------------------------------------------------- /JapaneseAddress/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-japanese-address", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension for proper Japanese Addresses format.", 10 | "authors":[ 11 | { 12 | "name": "Hirokazu Nishi", 13 | "email": "nishi@veriteworks.co.jp", 14 | "homepage": "https://veriteworks.co.jp/", 15 | "role": "developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "~7.1.3||~7.2.0||~7.3.0", 20 | "magento/framework": "^102.0.0", 21 | "magento/module-eav": "^102.0.0", 22 | "magento/module-customer": "^102.0.0", 23 | "magento/module-checkout": "^100.3.0", 24 | "magento/module-directory": "^100.3.0", 25 | "magento/module-sales": "^102.0.0", 26 | "magento/module-reports": "^100.3.0", 27 | "magento/module-ui": "^101.1.0" 28 | }, 29 | "suggest": { 30 | "community-engineering/module-japanese-name": "^1.0.0", 31 | "community-engineering/module-japanese-region": "^1.0.0" 32 | }, 33 | "autoload": { 34 | "files": [ 35 | "registration.php" 36 | ], 37 | "psr-4": { 38 | "CommunityEngineering\\JapaneseAddress\\": "" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /JapaneseAddress/etc/adminhtml/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | Magento\Config\Model\Config\Source\Yesno 15 | customer/create_account/request_address 16 | 17 | 18 | 19 | 20 | 21 | Magento\Config\Model\Config\Source\Yesno 22 | customer/address/country_show 23 | 24 | 25 |
26 |
27 |
28 | -------------------------------------------------------------------------------- /JapaneseAddress/etc/frontend/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | CommunityEngineering\JapaneseAddress\Block\Checkout\CountryFieldVisibility 13 | CommunityEngineering\JapaneseAddress\Block\Checkout\BillingAddressComponent 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JapaneseAddress/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /JapaneseAddress/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Guest","ゲスト様" 2 | "Personal Information","個人情報" 3 | "Sign Up for Newsletter","ニュースレターを購読" 4 | "Address Information","住所情報" 5 | "Please select a region, state or province.","都道府県を選択してください" 6 | "Address","住所" 7 | "Street Address %1","番地 %1" 8 | "* Required Fields","* 必須項目" 9 | "Sign-in Information","サインイン情報" 10 | "Email","Eメール" 11 | "Password","パスワード" 12 | "Password Strength","パスワードの強度" 13 | "No Password","パスワード無し" 14 | "Confirm Password","パスワード再確認" 15 | "Create an Account","アカウント作成" 16 | "Back","戻る" 17 | "Contact Information","連絡先情報" 18 | "City","市区町村" 19 | "It's a default billing address.","標準の請求先" 20 | "Use as my default billing address","標準ご連絡先住所として使用する" 21 | "It's a default shipping address.","標準の配送先" 22 | "Use as my default shipping address","標準配送先住所として使用する" 23 | "Save Address","住所を保存" 24 | "Go back","戻る" 25 | "My billing and shipping address are the same","請求先住所と配送先住所は同じです" 26 | "Update","更新" 27 | "Cancel","キャンセル" 28 | "Provided Zip/Postal Code seems to be invalid.","ご入力された郵便番号は正しくないようです。" 29 | " Example: "," 正しい郵便番号の例: " 30 | "If you believe it is the right one you can ignore this notice.","ご入力された内容が正しい場合は、このメッセージを無視してください。" 31 | "Show Address on Customer Registration Form","会員登録フォームに住所を表示する" 32 | "Show Country","国を表示" 33 | -------------------------------------------------------------------------------- /JapaneseAddress/registration.php: -------------------------------------------------------------------------------- 1 | 7 |
8 | 33 | 34 | 35 |
36 |
37 |
38 | 39 | 40 |
41 |
42 |
43 | -------------------------------------------------------------------------------- /JapaneseAddress/view/base/ui_component/customer_address_form.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /JapaneseAddress/view/base/ui_component/customer_form.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 |
51 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/layout/customer_account_create.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/layout/customer_address_form.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/layout/multishipping_checkout_customer_address.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/requirejs-config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © Magento, Inc. All rights reserved. 3 | * See COPYING.txt for license details. 4 | */ 5 | 6 | var config = { 7 | config: { 8 | mixins: { 9 | 'Magento_Checkout/js/model/shipping-rates-validator': { 10 | 'CommunityEngineering_JapaneseAddress/js/postcode-validation-fix': true 11 | } 12 | } 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/web/js/postcode-validation-fix.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © Magento, Inc. All rights reserved. 3 | * See COPYING.txt for license details. 4 | */ 5 | 6 | define([ 7 | 'Magento_Checkout/js/model/postcode-validator', 8 | 'uiRegistry', 9 | 'mage/translate' 10 | ], function (postcodeValidator, registry, $t) { 11 | 'use strict'; 12 | 13 | return function (target) { 14 | 15 | /** 16 | * Validate postcode value. 17 | * 18 | * Default Magento implementation ready country id only form visible field 19 | * but in most cases country should by hidden from customer. 20 | * Implementation of postcodeValidation method should be copy of core implementation 21 | * except countryId value detection. 22 | * This fix should be migrated to the Magento_Checkout module eventually. 23 | * 24 | * @param {uiElement} postcodeElement 25 | * @return {Boolean} 26 | */ 27 | target.postcodeValidation = function (postcodeElement) { 28 | var countryElement, 29 | validationResult, 30 | warnMessage; 31 | 32 | if (postcodeElement == null || postcodeElement.value() == null) { 33 | return true; 34 | } 35 | 36 | postcodeElement.warn(null); 37 | 38 | countryElement = registry.get(postcodeElement.parentName + '.' + 'country_id'); 39 | validationResult = postcodeValidator.validate(postcodeElement.value(), countryElement.value()); 40 | 41 | if (!validationResult) { 42 | warnMessage = $t('Provided Zip/Postal Code seems to be invalid.'); 43 | 44 | if (postcodeValidator.validatedPostCodeExample.length) { 45 | warnMessage += $t(' Example: ') + postcodeValidator.validatedPostCodeExample.join('; ') + '. '; 46 | } 47 | warnMessage += $t('If you believe it is the right one you can ignore this notice.'); 48 | postcodeElement.warn(warnMessage); 49 | } 50 | 51 | return validationResult; 52 | }; 53 | 54 | return target; 55 | }; 56 | }); 57 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/web/template/checkout-address-search/billing-address/jp.html: -------------------------------------------------------------------------------- 1 | 7 |
8 | 9 |

10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 |
20 | 21 | 22 |
23 |
25 | 26 | 27 | 28 | :
29 |
30 |
31 |
32 | 33 | 34 | 35 | :
36 |
37 |
38 |
39 |
40 | 41 |
42 | 48 |
49 |
50 | 55 |
56 |
57 | 58 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/web/template/checkout-address-search/shipping-address/jp.html: -------------------------------------------------------------------------------- 1 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 |
19 |
21 | 22 | 23 | 24 | 25 | :
26 |
27 |
28 |
29 | 30 | 31 | 32 | :
33 |
34 |
35 |
36 |
37 | 38 |

39 |
40 |
41 | 47 |
48 |
49 | 55 |
56 |
57 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/web/template/checkout/billing-address.html: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | 10 |
11 | 13 | 15 |
16 | 17 | 18 |
19 | 20 |
21 | 22 |
23 | 24 |
25 | 26 |
27 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/web/template/checkout/billing-address/details.html: -------------------------------------------------------------------------------- 1 | 7 |
8 | 9 | 10 |
11 | 〒
12 | 13 |
14 |
15 | 16 | 17 | 18 | 19 | :
20 |
21 |
22 |
23 | 24 | 25 | 26 | :
27 |
28 |
29 |
30 | 31 | 37 |
38 | 39 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/web/template/checkout/shipping-address/address-renderer/jp.html: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | 10 | 11 |
12 | 〒
13 | 14 |
15 |
16 | 17 | 18 | 19 | 20 | :
21 |
22 |
23 |
24 | 25 | 26 | 27 | :
28 |
29 |
30 |
31 | 32 | 37 | 38 | 41 | 42 |
43 | -------------------------------------------------------------------------------- /JapaneseAddress/view/frontend/web/template/checkout/shipping-information/address-renderer/jp.html: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 |
11 | 〒
12 | 13 |
14 |
15 | 16 | 17 | 18 | 19 | :
20 |
21 |
22 |
23 | 24 | 25 | 26 | :
27 |
28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/LICENSE_AFL.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/JapaneseDefaultCmsPages/LICENSE_AFL.txt -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/README.md: -------------------------------------------------------------------------------- 1 | Module updates content of default Magento CMS pages with Japanese translation. -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-japanese-default-cms-pages", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 default CMS pages for Japanese merchants.", 10 | "require": { 11 | "php": "~7.1.3||~7.2.0||~7.3.0", 12 | "magento/framework": "^102.0.0", 13 | "magento/module-cms": "^103.0.0" 14 | }, 15 | "suggest": { 16 | "community-engineering/module-japanese-default-config": "^1.0.0" 17 | }, 18 | "autoload": { 19 | "files": [ 20 | "registration.php" 21 | ], 22 | "psr-4": { 23 | "CommunityEngineering\\JapaneseDefaultCmsPages\\": "" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "404 Not Found","404 ページが見つかりません。" 2 | "Whoops, our bad...","申し訳ありません。" 3 | "Home page","ホームページ" 4 | "Home Page","ホームページ" 5 | "Enable Cookies","クッキーを有効にする" 6 | "What are Cookies?","クッキーとは?" 7 | "Privacy and Cookie Policy","プライバシーポリシー" 8 | "magento://CommunityEngineering_JapaneseDefaultCmsPages::i18n/en_US/%1.html","magento://CommunityEngineering_JapaneseDefaultCmsPages::i18n/ja_JP/%1.html" 9 | -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/i18n/ja_JP/enable-cookies.html: -------------------------------------------------------------------------------- 1 |
2 |

「クッキー」とは、お客様が当ストアにアクセスしたときに、私たちが送信する小さなデータです。クッキーを使用すると、私たちはお客様を知り、お客様の経験をパーソナライズすることができます。さらに、お客様を詐欺から守ることもできます。

3 |

ブラウザーがクッキーを受け入れるように設定すると、商品の購入、保存、あなた向けのおすすめ機能の利用が可能になります。手順は以下のとおりです。

4 | 10 |
11 | -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/i18n/ja_JP/home.html: -------------------------------------------------------------------------------- 1 |

CMSホームページコンテンツはこちらです。

2 | -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/i18n/ja_JP/no-route.html: -------------------------------------------------------------------------------- 1 |
2 |
お客様がリクエストしたページは見つかりませんでした。考えられる原因は以下のとおりです。
3 |
4 |
8 |
9 |
10 |
どうすればいですか?
11 |
心配は無用です。サポートいたします。Magentoストアに戻る方法はたくさんあります。
12 |
13 | 18 |
19 |
20 | -------------------------------------------------------------------------------- /JapaneseDefaultCmsPages/registration.php: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | JP 13 | JP 14 | JP 15 | 16 | 17 | Asia/Tokyo 18 | ja_JP 19 | kgs 20 | 0 21 | 22 | 23 | JP 24 | 25 | 26 | 27 | 28 | JPY 29 | JPY 30 | JPY 31 | 32 | 33 | 34 | 35 | 0 36 | 37 |
38 | 2 39 | 0 40 | 0 41 | 0 42 | 0 43 | 0 44 | 0 45 | req 46 | 0 47 | 0 48 |
49 |
50 |
51 |
52 | -------------------------------------------------------------------------------- /JapaneseDefaultConfig/etc/db_schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 |
12 |
13 | -------------------------------------------------------------------------------- /JapaneseDefaultConfig/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /JapaneseDefaultConfig/registration.php: -------------------------------------------------------------------------------- 1 | config = $config; 29 | } 30 | 31 | /** 32 | * Should kana fields be present in customer and address data? 33 | * 34 | * @return bool 35 | */ 36 | public function areEnabled(): bool 37 | { 38 | $configValue = $this->config->getValue('customer/address/use_kana', ScopeInterface::SCOPE_STORE); 39 | return (bool)$configValue; 40 | } 41 | 42 | /** 43 | * Are kana fields required data? 44 | * 45 | * @return bool 46 | */ 47 | public function areRequired(): bool 48 | { 49 | if (!$this->areEnabled()) { 50 | return false; 51 | } 52 | 53 | $configValue = $this->config->getValue('customer/address/require_kana', ScopeInterface::SCOPE_STORE); 54 | return (bool)$configValue; 55 | } 56 | 57 | /** 58 | * Specify what type of kana may be used. 59 | * 60 | * @return int 61 | */ 62 | public function getKanaType(): int 63 | { 64 | $configValue = $this->config->getValue('customer/address/kana_type', ScopeInterface::SCOPE_STORE); 65 | if (!in_array($configValue, [ 66 | Source\Kana::TYPE_HIRAGANA, 67 | Source\Kana::TYPE_KATAKANA, 68 | Source\Kana::TYPE_ANY, 69 | ])) { 70 | throw new \InvalidArgumentException(sprintf( 71 | 'Ivalid kana type "%s" specified in config', 72 | $configValue 73 | )); 74 | } 75 | return (int)$configValue; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /JapaneseName/Model/Config/Source/Kana.php: -------------------------------------------------------------------------------- 1 | __('Only Katakana'), 30 | self::TYPE_HIRAGANA => __('Only Hiragana'), 31 | self::TYPE_ANY => __('Both') 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Quote/QuoteAddressKanaFieldsCleaning.php: -------------------------------------------------------------------------------- 1 | getData('quote_address'); 26 | if (!$address instanceof AddressInterface) { 27 | throw new \LogicException('Observer should be bound to event with quote address.'); 28 | } 29 | if (!$address instanceof DataObject) { 30 | throw new \LogicException('Current Kana implementation expects quote address to be data object.'); 31 | } 32 | 33 | $address->unsetData('firstnamkana'); 34 | $address->unsetData('lastnamkana'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Quote/QuoteAddressKanaFieldsSaver.php: -------------------------------------------------------------------------------- 1 | getData('quote_address'); 26 | if (!$address instanceof AddressInterface) { 27 | throw new \LogicException('Observer should be bound to event with quote address.'); 28 | } 29 | 30 | $addressExtension = $address->getExtensionAttributes(); 31 | if ($addressExtension === null) { 32 | return; 33 | } 34 | 35 | if (!$address instanceof DataObject) { 36 | throw new \LogicException('Current Kana implementation expects quote address to be data object.'); 37 | } 38 | 39 | if (!$address->hasData('firstnamekana')) { 40 | $address->setData('firstnamekana', $addressExtension->getFirstnamekana()); 41 | } 42 | if (!$address->hasData('lastnamekana')) { 43 | $address->setData('lastnamekana', $addressExtension->getLastnamekana()); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Quote/QuoteKanaFieldsCleaning.php: -------------------------------------------------------------------------------- 1 | getData('quote'); 26 | if (!$quote instanceof CartInterface) { 27 | throw new \LogicException('Observer should be bound to event with quote.'); 28 | } 29 | if (!$quote instanceof DataObject) { 30 | throw new \LogicException('Current Kana implementation expects quote to be data object.'); 31 | } 32 | 33 | $quote->unsetData('customer_firstnamekana'); 34 | $quote->unsetData('customer_lastnamekana'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Quote/QuoteKanaFieldsLoader.php: -------------------------------------------------------------------------------- 1 | cartExtensionFactory = $cartExtensionFactory; 34 | } 35 | 36 | /** 37 | * @inheritDoc 38 | */ 39 | public function execute(Observer $observer) 40 | { 41 | $quote = $observer->getData('quote'); 42 | if (!$quote instanceof CartInterface) { 43 | throw new \LogicException('Observer should be bound to event with quote.'); 44 | } 45 | if (!$quote instanceof DataObject) { 46 | throw new \LogicException('Current Kana implementation expects quote to be data object.'); 47 | } 48 | 49 | $quoteExtension = $quote->getExtensionAttributes(); 50 | if ($quoteExtension === null) { 51 | $quoteExtension = $this->cartExtensionFactory->create(); 52 | } 53 | 54 | $quoteExtension->setCustomerFirstnamekana($quote->getData('customer_firstnamekana')); 55 | $quote->unsetData('customer_firstnamekana'); 56 | $quoteExtension->setCustomerLastnamekana($quote->getData('customer_lastnamekana')); 57 | $quote->unsetData('customer_lastnamekana'); 58 | 59 | $quote->setExtensionAttributes($quoteExtension); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Quote/QuoteKanaFieldsSaver.php: -------------------------------------------------------------------------------- 1 | getData('quote'); 26 | if (!$quote instanceof CartInterface) { 27 | throw new \LogicException('Observer should be bound to event with quote.'); 28 | } 29 | 30 | $quoteExtension = $quote->getExtensionAttributes(); 31 | if ($quoteExtension === null) { 32 | return; 33 | } 34 | 35 | if (!$quote instanceof DataObject) { 36 | throw new \LogicException('Current Kana implementation expects quote to be data object.'); 37 | } 38 | 39 | if (!$quote->hasData('customer_firstnamekana')) { 40 | $quote->setData('customer_firstnamekana', $quoteExtension->getCustomerFirstnamekana()); 41 | } 42 | if (!$quote->hasData('customer_lastnamekana')) { 43 | $quote->setData('customer_lastnamekana', $quoteExtension->getCustomerLastnamekana()); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Sales/OrderAddressKanaFieldsCleaning.php: -------------------------------------------------------------------------------- 1 | getData('address'); 26 | if (!$address instanceof OrderAddressInterface) { 27 | throw new \LogicException('Observer should be bound to event with order address.'); 28 | } 29 | if (!$address instanceof DataObject) { 30 | throw new \LogicException('Current Kana implementation expects order address to be data object.'); 31 | } 32 | 33 | $address->unsetData('firstnamkana'); 34 | $address->unsetData('lastnamkana'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Sales/OrderAddressKanaFieldsSaver.php: -------------------------------------------------------------------------------- 1 | getData('address'); 26 | if (!$address instanceof OrderAddressInterface) { 27 | throw new \LogicException('Observer should be bound to event with order address.'); 28 | } 29 | 30 | $addressExtension = $address->getExtensionAttributes(); 31 | if ($addressExtension === null) { 32 | return; 33 | } 34 | 35 | if (!$address instanceof DataObject) { 36 | throw new \LogicException('Current Kana implementation expects order address to be data object.'); 37 | } 38 | 39 | if (!$address->hasData('firstnamekana')) { 40 | $address->setData('firstnamekana', $addressExtension->getFirstnamekana()); 41 | } 42 | if (!$address->hasData('lastnamekana')) { 43 | $address->setData('lastnamekana', $addressExtension->getLastnamekana()); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Sales/OrderKanaFieldsCleaning.php: -------------------------------------------------------------------------------- 1 | getData('order'); 26 | if (!$order instanceof OrderInterface) { 27 | throw new \LogicException('Observer should be bound to event with order.'); 28 | } 29 | if (!$order instanceof DataObject) { 30 | throw new \LogicException('Current Kana implementation expects order to be data object.'); 31 | } 32 | 33 | $order->unsetData('customer_firstnamekana'); 34 | $order->unsetData('customer_lastnamekana'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /JapaneseName/Observer/Sales/OrderKanaFieldsSaver.php: -------------------------------------------------------------------------------- 1 | getData('order'); 26 | if (!$order instanceof OrderInterface) { 27 | throw new \LogicException('Observer should be bound to event with order.'); 28 | } 29 | 30 | $orderExtension = $order->getExtensionAttributes(); 31 | if ($orderExtension === null) { 32 | return; 33 | } 34 | 35 | if (!$order instanceof DataObject) { 36 | throw new \LogicException('Current Kana implementation expects order to be data object.'); 37 | } 38 | 39 | if (!$order->hasData('customer_firstnamekana')) { 40 | $order->setData('customer_firstnamekana', $orderExtension->getCustomerFirstnamekana()); 41 | } 42 | if (!$order->hasData('customer_lastnamekana')) { 43 | $order->setData('customer_lastnamekana', $orderExtension->getCustomerLastnamekana()); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /JapaneseName/Plugin/Customer/Block/Account/Dashboard/InfoNameKana.php: -------------------------------------------------------------------------------- 1 | getCustomer(); 28 | if (!$customer) { 29 | return $name; 30 | } 31 | 32 | $firstnamekana = $this->getCustomAttributeValue($customer, 'firstnamekana'); 33 | $lastnamekana = $this->getCustomAttributeValue($customer, 'lastnamekana'); 34 | $namekana = trim(sprintf('%s %s', $lastnamekana, $firstnamekana)); 35 | 36 | if (empty($namekana)) { 37 | return $name; 38 | } elseif (empty($name)) { 39 | return $namekana; 40 | } else { 41 | return sprintf('%s (%s)', $name, $namekana); 42 | } 43 | } 44 | 45 | /** 46 | * Read custom attribute value 47 | * 48 | * @param CustomAttributesDataInterface $container 49 | * @param string $attributeCode 50 | * @return null|string 51 | */ 52 | private function getCustomAttributeValue(CustomAttributesDataInterface $container, string $attributeCode):? string 53 | { 54 | $attribute = $container->getCustomAttribute($attributeCode); 55 | if ($attribute === null) { 56 | return $attribute; 57 | } 58 | 59 | return $attribute->getValue(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /JapaneseName/Plugin/Customer/Block/Address/Edit/CopyKanaToNewAddress.php: -------------------------------------------------------------------------------- 1 | getAddress()->getId()) { 26 | return $form; 27 | } 28 | 29 | $this->copyAttributeFromCustomerToAddress($form, 'firstnamekana'); 30 | $this->copyAttributeFromCustomerToAddress($form, 'lastnamekana'); 31 | 32 | return $form; 33 | } 34 | 35 | /** 36 | * Copy customer custom attribute to corresponding address attribute. 37 | * 38 | * @param Edit $form 39 | * @param string $attributeCode 40 | */ 41 | private function copyAttributeFromCustomerToAddress(Edit $form, string $attributeCode) 42 | { 43 | $form->getAddress()->setCustomAttribute( 44 | $attributeCode, 45 | $form->getCustomer()->getCustomAttribute($attributeCode)->getValue() 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /JapaneseName/Plugin/Customer/Block/Address/KanaAttributesRenderer.php: -------------------------------------------------------------------------------- 1 | flatAttribute($addressAttributes, 'firstnamekana'); 29 | $addressAttributes = $this->flatAttribute($addressAttributes, 'lastnamekana'); 30 | return [$addressAttributes, $format]; 31 | } 32 | 33 | /** 34 | * Copy extension attribute to main data if missed. 35 | * 36 | * @param array $addressAttributes 37 | * @param string $attributeCode 38 | * @return array 39 | */ 40 | private function flatAttribute(array $addressAttributes, string $attributeCode) 41 | { 42 | if (isset($addressAttributes[$attributeCode])) { 43 | return $addressAttributes; 44 | } 45 | 46 | if (!isset($addressAttributes['extension_attributes'])) { 47 | return $addressAttributes; 48 | } 49 | 50 | $extensions = $addressAttributes['extension_attributes']; 51 | $accessor = 'get' . join('', array_map('ucfirst', explode('_', $attributeCode))); 52 | if (!is_callable([$extensions, $accessor])) { 53 | return $addressAttributes; 54 | } 55 | 56 | $addressAttributes[$attributeCode] = $extensions->{$accessor}(); 57 | 58 | return $addressAttributes; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /JapaneseName/Plugin/Customer/Block/Widget/Name.php: -------------------------------------------------------------------------------- 1 | kanaFieldsConfig = $kanaFieldsConfig; 31 | } 32 | 33 | /** 34 | * Substitute default template. 35 | * 36 | * @param Subject $subject 37 | * @param string $template 38 | * @return array 39 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 40 | */ 41 | public function beforeSetTemplate(Subject $subject, string $template) 42 | { 43 | if ($template === 'Magento_Customer::widget/name.phtml' && $this->kanaFieldsConfig->areEnabled()) { 44 | return ['CommunityEngineering_JapaneseName::customer/widget/name.phtml']; 45 | } 46 | return [$template]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /JapaneseName/Plugin/Customer/Model/Delegation/NewOperationNormalization.php: -------------------------------------------------------------------------------- 1 | getCustomer(); 37 | 38 | $this->normalizeDataObjects($customer); 39 | foreach ($customer->getAddresses() as $address) { 40 | $this->normalizeDataObjects($address); 41 | } 42 | 43 | return $result; 44 | } 45 | 46 | /** 47 | * If kana data present then they should be placed in custom attributes. 48 | * 49 | * @param mixed $dto 50 | */ 51 | private function normalizeDataObjects($dto): void 52 | { 53 | if (!$dto instanceof AbstractSimpleObject || !$dto instanceof CustomAttributesDataInterface) { 54 | return; 55 | } 56 | 57 | $data = $dto->__toArray(); 58 | foreach (['firstnamekana', 'lastnamekana'] as $kanaAttribute) { 59 | if (array_key_exists($kanaAttribute, $data)) { 60 | $dto->setCustomAttribute($kanaAttribute, $data[$kanaAttribute]); 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /JapaneseName/Plugin/Framework/Data/ExtensionAttributesValues.php: -------------------------------------------------------------------------------- 1 | __toArray(); 41 | } 42 | 43 | if (empty($extensions)) { 44 | return $formOut; 45 | } 46 | 47 | $formOut->addValues($extensions); 48 | return $formOut; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /JapaneseName/Plugin/Quote/Model/Quote/ExportAddressKana.php: -------------------------------------------------------------------------------- 1 | getExtensionAttributes(); 28 | if ($addressExtension === null) { 29 | return $to; 30 | } 31 | 32 | $to->setCustomAttribute('firstnamekana', $addressExtension->getFirstnamekana()); 33 | $to->setCustomAttribute('lastnamekana', $addressExtension->getLastnamekana()); 34 | 35 | return $to; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /JapaneseName/README.md: -------------------------------------------------------------------------------- 1 | This module adds kana fields to customer and address which allow to describe phonetic of customer name. -------------------------------------------------------------------------------- /JapaneseName/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-japanese-name", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension for Japanese names Kana.", 10 | "authors":[ 11 | { 12 | "name": "Hirokazu Nishi", 13 | "email": "nishi@veriteworks.co.jp", 14 | "homepage": "https://veriteworks.co.jp/", 15 | "role": "developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "~7.1.3||~7.2.0||~7.3.0", 20 | "magento/framework": "^102.0.0", 21 | "magento/module-eav": "^102.0.0", 22 | "magento/module-customer": "^102.0.0", 23 | "magento/module-checkout": "^100.3.0", 24 | "magento/module-sales": "^102.0.0", 25 | "magento/module-quote": "^101.1.0" 26 | }, 27 | "autoload": { 28 | "files": [ 29 | "registration.php" 30 | ], 31 | "psr-4": { 32 | "CommunityEngineering\\JapaneseName\\": "" 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /JapaneseName/etc/adminhtml/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | Magento\Config\Model\Config\Source\Yesno 16 | customer/address/use_kana 17 | 18 | 19 | 20 | Magento\Config\Model\Config\Source\Yesno 21 | customer/address/require_kana 22 | 23 | 1 24 | 25 | 26 | 27 | 28 | CommunityEngineering\JapaneseName\Model\Config\Source\Kana 29 | customer/address/kana_type 30 | 31 | 1 32 | 33 | 34 | 35 |
36 |
37 |
38 | -------------------------------------------------------------------------------- /JapaneseName/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 |
12 | 1 13 | 1 14 | 3 15 |
16 |
17 |
18 |
19 | -------------------------------------------------------------------------------- /JapaneseName/etc/db_schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
32 | 33 | 34 | 35 |
36 |
-------------------------------------------------------------------------------- /JapaneseName/etc/extension_attributes.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JapaneseName/etc/frontend/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | CommunityEngineering\JapaneseName\Block\KanaFormViewModel 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | CommunityEngineering\JapaneseName\Block\Checkout\KanaFieldsProcessor 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /JapaneseName/etc/indexer.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 11 |
12 | 13 |
14 |
15 |
16 | -------------------------------------------------------------------------------- /JapaneseName/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /JapaneseName/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Only Katakana","カタカナのみ" 2 | "Only Hiragana","ひらがなのみ" 3 | "Both","両方" 4 | "Name","名前" 5 | "Name Kana Options","ふりがなオプション" 6 | "Use Kana","フリガナを使用する" 7 | "Require Kana on frontend","フロントエンドでフリガナ必須" 8 | "Acceptable Kana character type on frontend","フロントエンドで許可するカナの種類" 9 | "Name Kana","フリガナ(名前)" 10 | "Firstname Kana","フリガナ(名)" 11 | "Lastname Kana","フリガナ(姓)" 12 | "First Name Kana","フリガナ(名)" 13 | "Last Name Kana","フリガナ(姓)" 14 | "Billing Firstname Kana","支払人の名 (フリガナ)" 15 | "Billing Lastname Kana","支払人の姓 (フリガナ)" 16 | "Please use full width kana only in this field.","全角かなで入力してください。" 17 | "Please use full width Katakana only in this field.","全角カタカナで入力してください。" 18 | "Please use Hiragana only in this field.","全角ひらがなで入力してください。" -------------------------------------------------------------------------------- /JapaneseName/registration.php: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | madefor.github.io 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /JapanesePostalCode/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /JapanesePostalCode/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Provided Zip/Postal Code seems to be invalid.","ご入力された郵便番号は正しくないようです。" 2 | " Example: "," 正しい郵便番号の例: " 3 | "Provided Zip/Postal Code is unknown.","ご入力いただいた郵便番号が不明です。" 4 | "Unable to verify provided Zip/Postal Code.","郵便番号を検証できませんでした。" 5 | "If you believe it is the right one you can ignore this notice.","ご入力された内容が正しい場合は、このメッセージを無視してください。" 6 | -------------------------------------------------------------------------------- /JapanesePostalCode/registration.php: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /JapanesePostalCode/view/frontend/layout/customer_address_form.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /JapanesePostalCode/view/frontend/layout/multishipping_checkout_customer_address.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /JapanesePostalCode/view/frontend/requirejs-config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © Magento, Inc. All rights reserved. 3 | * See COPYING.txt for license details. 4 | */ 5 | 6 | var config = { 7 | map: { 8 | '*': { 9 | postalCodeDataProvider: 'CommunityEngineering_JapanesePostalCode/js/service/madefor-postal-code-api' 10 | } 11 | }, 12 | config: { 13 | mixins: { 14 | 'Magento_Ui/js/form/element/post-code': { 15 | 'CommunityEngineering_JapanesePostalCode/js/ui/form-postal-code-element': true 16 | } 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /JapanesePostalCode/view/frontend/templates/address_updater_widget_binding.phtml: -------------------------------------------------------------------------------- 1 | 7 | 20 | -------------------------------------------------------------------------------- /JapaneseRegion/LICENSE_AFL.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magento/magento2-jp/b6e58570b95fbd00be47876f33d4db62c036a209/JapaneseRegion/LICENSE_AFL.txt -------------------------------------------------------------------------------- /JapaneseRegion/Model/ResourceModel/Directory/Region/Collection.php: -------------------------------------------------------------------------------- 1 | _init( 26 | \Magento\Directory\Model\Region::class, 27 | \Magento\Directory\Model\ResourceModel\Region::class 28 | ); 29 | 30 | $this->_countryTable = $this->getTable('directory_country'); 31 | $this->_regionNameTable = $this->getTable('directory_country_region_name'); 32 | 33 | $this->addOrder('region_id', DataCollection::SORT_ORDER_ASC); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /JapaneseRegion/README.md: -------------------------------------------------------------------------------- 1 | Module provides list of Japan prefectures in traditional order. 2 | -------------------------------------------------------------------------------- /JapaneseRegion/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-japanese-region", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension for Japanese Region.", 10 | "authors":[ 11 | { 12 | "name": "Hirokazu Nishi", 13 | "email": "nishi@veriteworks.co.jp", 14 | "homepage": "https://veriteworks.co.jp/", 15 | "role": "developer" 16 | } 17 | ], 18 | "config": { 19 | "sort-packages": true 20 | }, 21 | "require": { 22 | "php": "~7.1.3||~7.2.0||~7.3.0", 23 | "magento/framework": "^102.0.0", 24 | "magento/module-config": "^101.1.0", 25 | "magento/module-directory": "^100.3.0" 26 | }, 27 | "autoload": { 28 | "files": [ 29 | "registration.php" 30 | ], 31 | "psr-4": { 32 | "CommunityEngineering\\JapaneseRegion\\": "" 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /JapaneseRegion/etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /JapaneseRegion/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /JapaneseRegion/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Please select a region, state or province.","都道府県を選択してください" 2 | -------------------------------------------------------------------------------- /JapaneseRegion/registration.php: -------------------------------------------------------------------------------- 1 | config = $config; 28 | } 29 | 30 | /** 31 | * Get store address template for format. 32 | * 33 | * Supported formats are: text, oneline, html, pdf. 34 | * 35 | * @param string $format 36 | * @return string 37 | */ 38 | public function getAddressTemplate(string $format): string 39 | { 40 | $configValue = $this->config->getValue('general/store_address_template/' . $format); 41 | return $configValue; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/Plugin/Store/Model/Address/Renderer.php: -------------------------------------------------------------------------------- 1 | eventManager = $eventManager; 49 | $this->filterManager = $filterManager; 50 | $this->config = $config; 51 | } 52 | 53 | /** 54 | * Format store address display for JP locale. 55 | * 56 | * @param BaseRenderer $renderer 57 | * @param \Closure $proceed 58 | * @param DataObject $storeInfo 59 | * @param string $type 60 | * @return string 61 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 62 | */ 63 | public function aroundFormat( 64 | BaseRenderer $renderer, 65 | \Closure $proceed, 66 | DataObject $storeInfo, 67 | $type = 'html' 68 | ) { 69 | $this->eventManager->dispatch( 70 | 'store_address_format', 71 | [ 72 | 'type' => $type, 73 | 'store_info' => $storeInfo 74 | ] 75 | ); 76 | $address = $this->filterManager->template( 77 | $this->config->getAddressTemplate($type), 78 | ['variables' => $storeInfo->getData()] 79 | ); 80 | 81 | return $address; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/README.md: -------------------------------------------------------------------------------- 1 | @TODO 2 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-japanese-store-address", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension for Modify Store Address.", 10 | "authors":[ 11 | { 12 | "name": "Hirokazu Nishi", 13 | "email": "nishi@veriteworks.co.jp", 14 | "homepage": "https://veriteworks.co.jp/", 15 | "role": "developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "~7.1.3||~7.2.0||~7.3.0", 20 | "magento/framework": "^102.0.0", 21 | "magento/module-store": "^101.0.0" 22 | }, 23 | "autoload": { 24 | "files": [ 25 | "registration.php" 26 | ], 27 | "psr-4": { 28 | "CommunityEngineering\\JapaneseStoreAddress\\": "" 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/etc/adminhtml/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | general/store_address_template/text 10 | 11 | 12 | 13 | general/store_address_template/oneline 14 | 15 | 16 | 17 | general/store_address_template/html 18 | 19 | 20 | 21 | general/store_address_template/pdf 22 | 23 | 24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | {{/depend}} 18 | {{depend postcode}}〒{{var postcode}}
{{/depend}} 19 | {{depend region}}{{var region}}{{/depend}}{{depend city}}{{var city}}{{/depend}}{{depend street_line1}}{{var street_line1}}{{/depend}}{{depend street_line2}} {{var street_line1}}{{/depend}} 20 | {{depend telephone}}
T: {{var telephone}}{{/depend}}]]> 21 | 25 |
26 |
27 |
28 |
29 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Store Address Template","店舗住所テンプレート" 2 | "Text","テキスト" 3 | "Text One Line","一行テキスト" 4 | "HTML","HTML" 5 | "PDF","PDF" 6 | -------------------------------------------------------------------------------- /JapaneseStoreAddress/registration.php: -------------------------------------------------------------------------------- 1 | containsOnlyAscii($original)) { 27 | return $original; 28 | } 29 | 30 | foreach ($this->getTransliterators() as $transliterator) { 31 | $transliterated = $transliterator->transliterate($original); 32 | if ($this->containsOnlyAscii($transliterated)) { 33 | return $transliterated; 34 | } 35 | } 36 | 37 | return $original; 38 | } 39 | 40 | /** 41 | * Creates list of ICU Transliterators to try. 42 | * 43 | * @return array 44 | * 45 | * @see http://userguide.icu-project.org/transforms/general 46 | */ 47 | private function getTransliterators(): array 48 | { 49 | return [ 50 | \Transliterator::create('Katakana-Latin'), 51 | \Transliterator::create('Hiragana-Latin'), 52 | ]; 53 | } 54 | 55 | /** 56 | * Check if string contains only ASCII symbols. 57 | * 58 | * @param string $text 59 | * @return bool 60 | */ 61 | private function containsOnlyAscii(string $text): bool 62 | { 63 | return (bool)mb_detect_encoding($text, 'ASCII', true); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /JapaneseUrlRewrite/Plugin/Filter/Translit.php: -------------------------------------------------------------------------------- 1 | transliterator = $transliterator; 31 | } 32 | 33 | /** 34 | * Apply Japanese transliterator if original fails. 35 | * 36 | * @param \Magento\Framework\Filter\Translit $filter 37 | * @param string $result 38 | * @param string $input 39 | * @return string 40 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 41 | */ 42 | public function afterFilter($filter, $result, $input) 43 | { 44 | if ($result === $input && !empty($input)) { 45 | $result = $this->transliterator->transliterate($input); 46 | } 47 | 48 | return $result; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /JapaneseUrlRewrite/Plugin/Filter/TranslitUrl.php: -------------------------------------------------------------------------------- 1 | transliterator = $transliterator; 31 | } 32 | 33 | /** 34 | * URL decode input before transliteration. 35 | * 36 | * Magento may pass same string several times for transliteration. 37 | * After plugin encode data to allow natinal characters ini URLs. 38 | * 39 | * @param \Magento\Framework\Filter\TranslitUrl $filter 40 | * @param string $input 41 | * @return array 42 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 43 | */ 44 | public function beforeFilter( 45 | \Magento\Framework\Filter\TranslitUrl $filter, 46 | $input 47 | ) { 48 | $decoded = urldecode($input); 49 | return [ 50 | $decoded 51 | ]; 52 | } 53 | 54 | /** 55 | * Apply Japanese transliterator if original fails. 56 | * 57 | * As now filtered text may contain not only URL safe characters it should be properly encoded. 58 | * 59 | * @param \Magento\Framework\Filter\TranslitUrl $filter 60 | * @param string $result 61 | * @param string $input 62 | * @return string 63 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 64 | */ 65 | public function afterFilter( 66 | \Magento\Framework\Filter\TranslitUrl $filter, 67 | $result, 68 | $input 69 | ) { 70 | if (empty($result) && !empty($input)) { 71 | $result = $this->transliterator->transliterate($input); 72 | } 73 | 74 | $encoded = urlencode($result); 75 | return $encoded; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /JapaneseUrlRewrite/README.md: -------------------------------------------------------------------------------- 1 | Module adds support of Japanese symbols in generated URLs for catalog categories, products and CMS pages. 2 | -------------------------------------------------------------------------------- /JapaneseUrlRewrite/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-japanese-url-rewrite", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension to allow use Japanese symbols in URL rewrites.", 10 | "require": { 11 | "php": "~7.1.3||~7.2.0||~7.3.0", 12 | "magento/framework": "^102.0.0" 13 | }, 14 | "suggest": { 15 | "magento/module-catalog-url-rewrite": "^100.3.0", 16 | "magento/module-cms-url-rewrite": "^100.3.0" 17 | }, 18 | "autoload": { 19 | "files": [ 20 | "registration.php" 21 | ], 22 | "psr-4": { 23 | "CommunityEngineering\\JapaneseUrlRewrite\\": "" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /JapaneseUrlRewrite/etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /JapaneseUrlRewrite/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /JapaneseUrlRewrite/registration.php: -------------------------------------------------------------------------------- 1 | __('Default (e.g. ¥123)'), 34 | self::KANJI => __('Kanji (e.g. 123円)'), 35 | ]; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/Model/Config/YenFormattingConfig.php: -------------------------------------------------------------------------------- 1 | scopeConfig = $scopeConfig; 28 | } 29 | 30 | /** 31 | * Read configured Japanese Yen format. 32 | * 33 | * @return string 34 | */ 35 | public function getFormat(): string 36 | { 37 | $configuredValue = $this->scopeConfig->getValue('currency/options/yen_formatting'); 38 | return $configuredValue; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/Model/CurrencyFormatOptionModifiers.php: -------------------------------------------------------------------------------- 1 | yenFormattingConfig = $yenFormattingConfig; 29 | } 30 | 31 | /** 32 | * Detect what options should be applied for correct currency displaying. 33 | * 34 | * @param string $currencyCode 35 | * @return array 36 | */ 37 | public function getOptions(string $currencyCode): array 38 | { 39 | if ($currencyCode !== 'JPY') { 40 | return []; 41 | } 42 | 43 | switch ($this->yenFormattingConfig->getFormat()) { 44 | case YenFormatting::DEFAULT: 45 | return []; 46 | case YenFormatting::KANJI: 47 | return [ 48 | 'position' => \Zend_Currency::RIGHT, 49 | 'symbol' => __('Yen'), 50 | ]; 51 | default: 52 | throw new \InvalidArgumentException('Unsupported format'); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/Observer/ModifyCurrencyFormattingOptions.php: -------------------------------------------------------------------------------- 1 | currencyFormatOptionModifiers = $currencyFormatOptionModifiers; 34 | } 35 | 36 | /** 37 | * @inheritdoc 38 | */ 39 | public function execute(Observer $observer) 40 | { 41 | $event = $observer->getEvent(); 42 | $currencyCode = $event->getData('base_code'); 43 | $currencyOptions = $event->getData('currency_options'); 44 | 45 | if ($currencyCode !== null) { 46 | $currencyOptions->addData($this->currencyFormatOptionModifiers->getOptions($currencyCode)); 47 | } 48 | return $this; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/Plugin/Directory/Model/YenFormatting.php: -------------------------------------------------------------------------------- 1 | currencyFormatOptionModifiers = $currencyFormatOptionModifiers; 30 | } 31 | 32 | /** 33 | * Add formatting options before format currency value. 34 | * 35 | * Only Currency::formatTxt should be pluginized as all other formatting methods should use its result. 36 | * 37 | * @param Currency $currency 38 | * @param float|string $price 39 | * @param array $originalOptions 40 | * @return array 41 | */ 42 | public function beforeFormatTxt( 43 | Currency $currency, 44 | $price, 45 | $originalOptions = [] 46 | ) { 47 | $modifiers = $this->currencyFormatOptionModifiers->getOptions((string)$currency->getCode()); 48 | $optionsToApply = array_merge($originalOptions, $modifiers); 49 | return [$price, $optionsToApply]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/README.md: -------------------------------------------------------------------------------- 1 | Module allows to modify display option for Japanese yen (JPY). Supported modes are Default (¥123) and Kanji (123 円). 2 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-japanese-yen-formatting", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension for Yen formatting.", 10 | "authors":[ 11 | { 12 | "name": "Hirokazu Nishi", 13 | "email": "nishi@veriteworks.co.jp", 14 | "homepage": "https://veriteworks.co.jp/", 15 | "role": "developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "~7.1.3||~7.2.0||~7.3.0", 20 | "magento/framework": "^102.0.0", 21 | "magento/module-directory": "^100.3.0" 22 | }, 23 | "autoload": { 24 | "files": [ 25 | "registration.php" 26 | ], 27 | "psr-4": { 28 | "CommunityEngineering\\JapaneseYenFormatting\\": "" 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/etc/adminhtml/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | CommunityEngineering\JapaneseYenFormatting\Model\Config\Source\YenFormatting 15 | currency/options/yen_formatting 16 | 17 | 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | default 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/etc/events.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/i18n/ja_JP.csv: -------------------------------------------------------------------------------- 1 | "Default (e.g. ¥123)","デフォルト (例: ¥123)" 2 | "Kanji (e.g. 123円)","漢字 (例: 123円)" 3 | "Yen","円" 4 | "Japanese Yen Formatting","日本円表示フォーマット" 5 | -------------------------------------------------------------------------------- /JapaneseYenFormatting/registration.php: -------------------------------------------------------------------------------- 1 | [ 24 | 'type' => 'kuromoji_tokenizer', 25 | 'mode'=> 'search', 26 | 'discard_punctuation'=> 'true', 27 | 'user_dictionary' => 'search_dic.csv' 28 | ], 29 | ]; 30 | return $tokenizer; 31 | } 32 | 33 | /** 34 | * @inheritdoc 35 | */ 36 | public function build() 37 | { 38 | $tokenizer = $this->getTokenizer(); 39 | $analyzerFilter = [ 40 | 'cjk_width', 41 | 'kuromoji_part_of_speech', 42 | 'kuromoji_baseform' 43 | ]; 44 | $filter = $this->getFilter(); 45 | $filter['synonym_dict'] = [ 46 | 'type' => 'synonym', 47 | 'synonyms_path' => 'synonym.txt' 48 | ]; 49 | $charFilter = $this->getCharFilter(); 50 | 51 | $settings = [ 52 | 'analysis' => [ 53 | 'analyzer' => [ 54 | 'default' => [ 55 | 'type' => 'custom', 56 | 'tokenizer' => key($tokenizer), 57 | 'filter' => array_merge( 58 | ['lowercase', 'keyword_repeat'], 59 | array_keys($filter), 60 | $analyzerFilter, 61 | ['synonym_dict'] 62 | ), 63 | 'char_filter' => array_keys($charFilter) 64 | ] 65 | ], 66 | 'tokenizer' => $tokenizer, 67 | 'filter' => $filter, 68 | 'char_filter' => $charFilter, 69 | ], 70 | ]; 71 | 72 | return $settings; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Kuromoji/README.md: -------------------------------------------------------------------------------- 1 | # Kuromoji tokenizer adapter for ElasticSearch 2 | By default, Magento can generate ElasticSearch default tokenizer based search index. This is useful for English and other non-agglutinative languages. 3 | However, Japanese is one of the agglutinative languages. To analyze Japanese sentences correctly, morphological analysis engine is necessary. 4 | 5 | This extension can improve Magento built-in ElasticSearch index. It uses Kuromoji as tokenizer and analyzer. You need to install it before you start to using this extension. 6 | Also, this extension can use synonym and user defined dictionary file. If you hope to improve your search result quality, please read ElasticSearch official documents and create your own dictionary and synonym files. 7 | 8 | # Before install 9 | 10 | Please install [Kuromoji](https://www.elastic.co/guide/en/elasticsearch/plugins/master/analysis-kuromoji.html) before you activate this extension. 11 | 12 | Also create these 2 files into ElasticSearch home directory. 13 | 14 | - search_dic.csv 15 | - synonym.txt 16 | 17 | search_dic.csv is user defined dictionary. Its format is described in [ElasticSearch document](https://www.elastic.co/guide/en/elasticsearch/plugins/5.0/analysis-kuromoji-tokenizer.html). 18 | synonym.txt is user defined synonym file. Its format is described in [ElasticSearch document](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/analysis-synonym-tokenfilter.html). 19 | -------------------------------------------------------------------------------- /Kuromoji/SearchAdapter/Query/Builder/Aggregation.php: -------------------------------------------------------------------------------- 1 | fieldMapper->getFieldName($bucket->getField()); 30 | switch ($bucket->getType()) { 31 | case BucketInterface::TYPE_TERM: 32 | $searchQuery['body']['aggregations'][$bucket->getName()]= [ 33 | 'terms' => [ 34 | 'field' => $field, 35 | 'size' => 2000 36 | ], 37 | ]; 38 | break; 39 | case BucketInterface::TYPE_DYNAMIC: 40 | $searchQuery['body']['aggregations'][$bucket->getName()]= [ 41 | 'extended_stats' => [ 42 | 'field' => $field, 43 | ], 44 | ]; 45 | break; 46 | } 47 | return $searchQuery; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Kuromoji/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-engineering/module-kuromoji", 3 | "version": "1.0.1", 4 | "type": "magento2-module", 5 | "license": [ 6 | "OSL-3.0", 7 | "AFL-3.0" 8 | ], 9 | "description": "Magento2 extension for adding Kuromoji an Elasticsearch tokenizer .", 10 | "authors":[ 11 | { 12 | "name": "Hirokazu Nishi", 13 | "email": "nishi@veriteworks.co.jp", 14 | "homepage": "https://veriteworks.co.jp/", 15 | "role": "developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "~7.1.3||~7.2.0||~7.3.0", 20 | "magento/framework": "^102.0.0", 21 | "magento/module-elasticsearch": "^100.3.0", 22 | "lib-libxml": "*" 23 | }, 24 | "autoload": { 25 | "files": [ 26 | "registration.php" 27 | ], 28 | "psr-4": { 29 | "CommunityEngineering\\Kuromoji\\": "" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Kuromoji/etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Kuromoji/etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Kuromoji/registration.php: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | ja_JP 10 | CommunityEngineering 11 | ja_JP 12 | 13 | -------------------------------------------------------------------------------- /_phrases/registration.php: -------------------------------------------------------------------------------- 1 |