Shopware 6 Japanese Language Pack

A complete localization plugin built from scratch

Table of Contents

Shopware 6 is a European e-commerce platform with no Japanese language support. When developing an online shop for my wife (an illustrator), I decided to create the Japanese Language Pack for Shopware 6 to make it easier for Japanese developers to use. The current version v1.3.0 provides complete Japanese localization for both the storefront and admin panel.

Design Philosophy: Incremental Feature Development

Rather than aiming for perfection from the start, I chose an architecture that allows for incremental feature expansion.

<?php
public function install(InstallContext $installContext): void
{
    $this->createJapaneseLanguage($installContext->getContext());
    $this->createJapaneseCurrency($installContext->getContext());
    $this->createJapaneseCountry($installContext->getContext());
    $this->createJapanesePrefectures($installContext->getContext());
    $this->createJapaneseProductSorting($installContext->getContext());
    $this->createJapaneseMailTemplates($installContext->getContext());
    $this->createJapaneseStateMachineStates($installContext->getContext());
}

By separating each functionality into independent methods, I enable incremental releases and simplified maintenance.

Precise Handling of Japanese Yen Specifications

The Japanese yen has the unique characteristic of not using decimal places. To represent this correctly in Shopware:

<?php
$currencyRepository->create([
    [
        'isoCode' => 'JPY',
        'name' => '日本円',
        'symbol' => '¥',
        'factor' => 1.0,
        'decimalPrecision' => 0,
        'shortName' => 'JPY',
        'position' => 1,
        'itemRounding' => [
            'decimals' => 0,
            'interval' => 0.01,
            'roundForNet' => false
        ],
        'totalRounding' => [
            'decimals' => 0,
            'interval' => 0.01,
            'roundForNet' => false
        ]
    ]
], $context);

Not only decimalPrecision: 0, but also unifying decimal handling in both itemRounding and totalRounding. This correctly displays “¥1,235” instead of “¥1,234.56”.

Implementation of 47 Prefecture Data

Prefecture selection is essential for Japanese e-commerce websites. I implemented all 47 prefectures using Shopware’s standard state management:

<?php
private function getPrefecturesData(): array
{
    return [
        ['code' => 'JP-01', 'name' => 'Hokkaido', 'nameJa' => '北海道'],
        ['code' => 'JP-02', 'name' => 'Aomori', 'nameJa' => '青森県'],
        // ...all 47 prefectures
    ];
}

public function createPrefectures(Context $context): void
{
    foreach ($this->getPrefecturesData() as $prefecture) {
        // Existence check and creation logic
    }
}

By storing both English and Japanese names, usage is enabled in international environments as well.

Drawing the Japanese Flag with CSS Gradients

Instead of relying on image files, I create the Japanese flag using CSS gradients:

.language-flag {
  &.country-jp {
    background: radial-gradient(
        5px at 50% 50%,
        #bc002d 0,
        #bc002d 35%,
        transparent 35%,
        transparent 100%
      ), white;
    border: 1px solid $gray-500;
  }
}

Using radial-gradient, I draw a red circle in the center and make the outer area transparent to represent the Hinomaru. No image files are needed and the solution is lightweight.

Development Experiences and Insights

Unexpected Font Issues

Initially, it wasn’t clear why Japanese text wasn’t displaying in generated documents. The cause was the default fonts not supporting Japanese characters. By adjusting the font specification in document templates to Noto Sans CJK JP, the problem was resolved.

Efficient Translation Work with AI Support

Translation of admin panel and email templates wasn’t complex in content, but was very time-consuming due to the large number of files. AI proved extremely efficient for repetitive snippet translations and significantly accelerated the process.

Key Learnings

Through this project, I gained comprehensive understanding of Shopware’s entire localization architecture and valuable insights into e-commerce platform internationalization.

Achievements in v1.3.0

The current version v1.3.0 fully implements:

  • Complete Japanese localization: Storefront, admin panel, email templates, documents
  • Japan-specific adaptations: Yen currency, 47 prefectures, flag icon
  • Extensibility: Architecture allows for incremental feature additions

Future Outlook

This plugin significantly reduces language barriers for Japanese developers starting with Shopware 6. As a foundation for Shopware adoption in Japan, I plan to maintain it continuously.