Localize Your E‑Commerce Prices for Japan with SiteLocaleAI
Expanding into the Japanese market means more than just translating copy – you need culturally resonant pricing. Japanese shoppers respond best to charm pricing (e.g., ¥9,999 instead of ¥10,000). This tutorial walks you through using SiteLocaleAI to:
- Translate your site with any LLM you prefer.
- Convert USD prices to JPY using live exchange rates.
- Apply psychological rounding ("charm rounding").
- Pre‑render translated pages for SEO.
- Deploy on WordPress without Node.js.
1. Install the Drop‑in JS Library
SiteLocaleAI works with any front‑end framework (React, Vue, plain HTML) because it’s just a single script tag.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>My Store</title>
<!-- Load SiteLocaleAI -->
<script src="https://cdn.sitelocaleai.com/v1/sitelocaleai.min.js"></script>
</head>
<body>
<!-- Your store markup -->
<div id="app"></div>
<script>
// Initialize with your LLM API key (Claude, GPT‑4o‑mini, etc.)
SiteLocaleAI.init({
apiKey: "YOUR_LLM_API_KEY",
provider: "openai", // or "anthropic"
defaultLang: "en",
supportedLangs: ["en", "ja"]
});
</script>
</body>
</html>
Tip: Keep the key on the server side and expose it through a short proxy to avoid leaking credentials.
2. Set Up Price Localization
SiteLocaleAI ships a tiny utility you can import into any script. It fetches the latest USD → JPY rate, converts the amount, and applies charm rounding.
// price-utils.js
import { getExchangeRate } from "https://cdn.sitelocaleai.com/v1/exchange.js";
/**
* Convert a USD amount to JPY and apply psychological rounding.
* @param {number} usd - Price in USD.
* @returns {Promise<string>} Formatted JPY price (e.g., "¥9,999").
*/
export async function localizePrice(usd) {
const rate = await getExchangeRate("USD", "JPY");
const rawJpy = usd * rate;
// Charm rounding: round down to the nearest 9, 99, 999, etc.
const rounded = charmRound(rawJpy);
return `¥${rounded.toLocaleString('ja-JP')}`;
}
/**
* Round a number down to the nearest "9" series.
* Example: 10,274 → 9,999; 1,023 → 999.
*/
function charmRound(value) {
const magnitude = Math.pow(10, Math.floor(Math.log10(value)));
const base = magnitude - 1; // 9, 99, 999 …
return Math.floor(value / base) * base + (base - 1);
}
Using It in Your Product Card
import { localizePrice } from "./price-utils.js";
async function renderProduct(product) {
const priceEl = document.querySelector(`#price-${product.id}`);
const jpyPrice = await localizePrice(product.priceUsd);
priceEl.textContent = jpyPrice;
}
// Example product
renderProduct({ id: 42, priceUsd: 79.99 });
The function automatically updates whenever you change the defaultLang to "ja".
3. Translate Page Content on the Fly
SiteLocaleAI’s translatePage method walks the DOM, sends text nodes to your LLM, and replaces them with the target language.
// After the page loads
window.addEventListener('load', async () => {
// Switch to Japanese
await SiteLocaleAI.setLanguage('ja');
// Translate visible content
await SiteLocaleAI.translatePage();
});
For SEO you’ll want a static version of the translated page. That’s where the CLI comes in.
4. SEO‑Friendly Pre‑Rendering with the CLI
SiteLocaleAI includes a lightweight CLI that crawls your site, renders translations, and writes static HTML files. Search engines can then index fully localized pages.
# Install the CLI globally (requires Node 18+)
npm i -g @sitelocaleai/cli
# Run pre‑render for Japanese
sitelocaleai prerender \
--url https://myshop.com \
--lang ja \
--output ./dist/ja \
--api-key $LM_APILL_KEY
The command performs:
1. Fetches the live site.
2. Runs the same translatePage logic on the server.
3. Rewrites price placeholders using localizePrice.
4. Emits static HTML in ./dist/ja.
Deploy the dist/ja folder to your CDN or static host. Googlebot and Bingbot will now see a fully Japanese page, boosting international SEO.
5. WordPress Integration (No Node.js Required)
If your store runs on WordPress, SiteLocaleAI offers a plugin that bundles the library and CLI behind the scenes.
- Install the “SiteLocaleAI – SEO Translation” plugin from the WordPress repository.
- In Settings → SiteLocaleAI, paste your LLM API key and enable Japanese.
- Tick "Enable Price Localization" and set the source currency to USD.
- Save – the plugin automatically injects the script and runs
translatePageon every front‑end request. - For SEO, go to Tools → SiteLocaleAI Pre‑Render and click Generate Japanese HTML. The plugin stores the static files in
wp-content/uploads/sitelocaleai/ja/.
That’s it – no npm, no build step, just a classic WordPress workflow.
6. Verify the Result
Open the pre‑rendered page (https://myshop.com/ja/index.html) and check:
- All UI strings are in Japanese.
- Prices display with the ¥ symbol and end in 9 (e.g., ¥9,999).
- Meta tags (<title>, <meta description>) are also translated – SiteLocaleAI mirrors them automatically.
Use Google Search Console’s URL Inspection tool to confirm that the Japanese version is indexed.
7. Best Practices for Japanese E‑Commerce
| Practice | Why it matters |
|---|---|
| Use full‑width characters for numbers when possible | Aligns with Japanese typographic conventions. |
| Show tax‑inclusive pricing | Japanese shoppers expect the final price to be shown. |
Add hreflang="ja" tags |
Signals to search engines the language targeting. |
| Localize shipping and return policies | Improves trust and conversion. |
SiteLocaleAI automatically adds hreflang tags when you call setLanguage('ja').
8. Wrap‑Up
You now have a fully translated, price‑localized, SEO‑ready Japanese version of your e‑commerce store—powered by a self‑hosted LLM, charm rounding, and a zero‑code WordPress plugin.
Ready to launch your Japanese store? Try SiteLocaleAI today and watch your international sales climb.
For deeper configuration options, see the official docs:
- https://sitelocaleai.com/docs/quick-start
- https://sitelocaleai.com/docs/price-localization