Localize Your E‑Commerce Prices for Japan with SiteLocaleAI
Expanding an online store into Japan is more than just translating text. Japanese shoppers expect prices that feel natural, often ending in round numbers like ¥9,800 or ¥12,900 – a technique known as charm pricing. In this tutorial we’ll walk through a complete workflow using SiteLocaleAI, a self‑hosted JavaScript library that:
- Translates any website with your own LLM API key (Claude, GPT‑4o‑mini, etc.)
- Localizes prices with psychological rounding per currency
- Generates SEO‑friendly pre‑rendered pages via a CLI
- Works with any framework (React, Vue, WordPress, Shopify, …) and even offers a Node‑less WordPress plugin
By the end you’ll have a Japanese version of your store where every product price is rounded to the nearest ¥100 or ¥1,000, and search engines can index the fully translated pages.
1. Install the SiteLocaleAI library
If you’re using a bundler (Webpack, Vite, etc.) simply add the package:
npm install @sitelocaleai/core
For a pure‑HTML site you can load the UMD build directly:
<script src="https://cdn.sitelocaleai.com/v1/sitelocaleai.min.js"></script>
The library is framework‑agnostic, so you can drop it into a React component, a Vue template, or a plain HTML page.
2. Configure your LLM API key
SiteLocaleAI never stores your keys – you provide them at runtime. Create a small config file (e.g., sitelocale.config.js):
// sitelocale.config.js
export const localeConfig = {
// Choose the LLM you prefer – Claude, GPT‑4o‑mini, etc.
llmProvider: 'openai',
apiKey: 'YOUR_OPENAI_API_KEY',
// Target language for the store
targetLang: 'ja',
// Enable price localization
priceLocalization: true,
// Currency‑specific rounding rules (see next section)
roundingRules: {
JPY: { step: 100, round: 'nearest' }, // round to nearest ¥100
},
};
Import this config where you initialise the library:
import { initLocale } from '@sitelocaleai/core';
import { localeConfig } from './sitelocale.config.js';
initLocale(localeConfig);
3. Add price‑localization logic with charm rounding
SiteLocaleAI exposes a helper localizePrice that takes a numeric value and a currency code. We’ll wrap it to apply psychological rounding (also called charm pricing). The idea is to round down to the nearest 100 JPY for prices above ¥5,000, and up to the nearest 1,000 JPY for premium items.
/**
* Apply charm rounding for JPY prices.
* @param {number} amount – original price in USD (or your base currency)
* @returns {string} – formatted price in ¥
*/
function charmRoundJPY(amount) {
// Convert to JPY using a fixed exchange rate for demo purposes.
const exchangeRate = 150; // 1 USD ≈ 150 JPY
const jpy = Math.round(amount * exchangeRate);
// Apply charm rounding rules
if (jpy >= 5000) {
// Round down to nearest 100
const rounded = Math.floor(jpy / 100) * 100;
return `¥${rounded.toLocaleString()}`;
}
// For lower prices, round up to nearest 1,000
const rounded = Math.ceil(jpy / 1000) * 1000;
return `¥${rounded.toLocaleString()}`;
}
Now use this function when rendering product cards:
import { localizeText } from '@sitelocaleai/core';
function renderProduct(product) {
const title = localizeText(product.title); // translated via LLM
const price = charmRoundJPY(product.priceUSD);
return `
<div class="product-card">
<h2>${title}</h2>
<p class="price">${price}</p>
</div>
`;
}
Every time the page loads, the library sends the product title to your LLM, receives a Japanese translation, and the price is shown with charm rounding.
4. Pre‑render SEO‑friendly pages with the CLI
Search engines struggle with client‑side rendering. SiteLocaleAI’s CLI can crawl your site, translate all content, and output static HTML files that Google can index.
npx @sitelocaleai/cli prerender \
--src ./public \
--out ./dist/jp \
--config ./sitelocale.config.js
--srcpoints to your original site folder.--outis where the Japanese static files will be written.- The CLI respects the same
localeConfig, so price rounding is applied during pre‑rendering.
After the command finishes, you’ll have a complete set of Japanese pages (index.html, product/123.html, …) that you can serve from a sub‑directory (/jp) or a separate domain (example.jp).
Tip: Add a
robots.txtrule to point Googlebot at the pre‑rendered version:Sitemap: https://example.com/jp/sitemap.xml
5. WordPress users – no Node.js required
If your store runs on WordPress, SiteLocaleAI offers a plugin that bundles the library and the CLI logic into a simple admin UI.
- Install SiteLocaleAI – WP from the plugin repository.
- In the settings page, paste your LLM API key and select “Japanese – ja”.
- Enable “Price Localization” and set the rounding step to
100. - Click Generate Japanese Pages – the plugin runs the pre‑rendering in the background and creates a
/jpsub‑site.
The plugin also adds a shortcode [sitelocale_price amount="49.99"] that automatically applies charm rounding.
6. Verify SEO and analytics
After deploying the Japanese version, check that search engines see the translated content:
- Use Google Search Console → URL Inspection on a
/jp/product/xyzpage. - Verify the
<html lang="ja">attribute and that price numbers appear as¥12,800. - Monitor organic traffic in Google Analytics with a custom segment for the
/jppath.
For more details on SEO best practices, see our docs: https://sitelocaleai.com/docs/seo.
7. Wrap‑up
You’ve now built a fully localized Japanese storefront:
- UI text translated via your own LLM API key.
- Prices shown in JPY with charm rounding that feels natural to Japanese shoppers.
- SEO‑friendly static pages that search engines can crawl and index.
All of this was achieved with a few lines of JavaScript and a single CLI command—no third‑party SaaS subscription required.
Ready to go global? Try SiteLocaleAI today and watch your international sales soar. 🚀