Akinon Release Notes (05/12/2025) are now live! Click here to learn what's new.
LogoLogo
API Reference
  • Home
  • Quick Start
  • Tutorials
  • Technical Guides
  • Release Notes
  • Glossary
  • Welcome to Akinon Technical Guides
  • ACC
    • ACC CLI
    • Create Application via CLI
    • Deploy Environment Variables
    • App Store for Developers
  • Omnitron
    • Product Types
    • Product Categorization
    • Splitting a Merged Order Item
  • Commerce
    • Shipping Rules Calculator
    • Data Source Shipping Options
    • Attribute Based Shipping Options
    • Filtering Products
    • Conversation & Messages
    • Sitemap Configuration
    • Weight-Based Product Sales
    • Group Attribute Sets
    • Contract Management
    • Find in Store for Whippy Ware
    • Plugins
    • Remote Price
    • E-mail Templates
    • Loyalty Accounts
    • Search Structure
    • User Segmentation & Rules
    • Promotions
  • OMS
    • Getting Started with OMS
    • Basic Setup
    • Scenarios
    • Capacity Feature
    • Package Management
      • Packages
      • Transfer
      • States
    • Commands
      • Packages
        • Package Command Parameters
        • DeAllocate Package Reservations Command
        • Channel Based Complete Packaging without Shipment Command
        • Complete Packaging with Shipment Command
        • Complete Packaging without Shipment Command
        • Package Refuse with Denial Reason Command
        • Product Not Found & Wrong Product Command
        • Product Not Found & Wrong Product Command Advanced
        • Package Packed for Refund Command
        • Block The Package For Action Command
        • Unblock the Package For Action Command
        • Update The Package’s Invoice
        • Manual Planning Command
      • Transfer
        • Transfer Order Advanced Command
        • Product for Transfer Not Found & Wrong Product Command
        • Transfer Delivered Command
        • Transfer Dispatch Command
        • Transfer Ready for Dispatch Command
        • Transfer Out Of Stock
      • Shipment
        • Shipment Order Command
        • Package Advanced Shipment Command
        • Ship The Package Command
        • Ship The Package without Shipment Integration Command
        • Update The Package’s Shipment Status Command
        • Update Shipment Info of Package Command
    • Inventory Locations & Engine
      • Properties & Domain Relation
      • Customization
      • Inventory Engine
    • Fulfillment
      • Shipments
      • Invoice Integration
    • Webhooks
      • Webhook Examples
        • Order Webhook
        • Package Webhook
        • Shipment Webhook
        • Stock Location Webhook
        • Transfer Webhook
    • Integrating OMS with Seller Center
  • Instore
    • Getting Started
    • Cash Register Integration
    • OTP (One Time Password) Process
    • Services
      • Password Reset Services
  • Marketplace Dashboard
    • N11 Marketplace Setup Configurations
    • Trendyol Marketplace Setup Configurations
    • Walmart Marketplace Setup Configurations
    • Amazon Marketplace Setup Configurations
    • Hepsiburada Marketplace Setup Configurations
  • Project Zero
    • Django
      • Basic Setup
      • Project Structure
        • Templates & Components
        • Private Dependencies
        • Omnife Project Submodule
        • Webpack
        • ESLint Rules
        • Bundles
        • Multilanguage & Translation
        • Environmental File
        • Custom Error Pages
        • Icon Font
      • Page Types
        • Static Pages & Flatpages
        • Account Page
          • Template Rendering in Account Pages
          • Forms & Validation
        • Basket Page
          • Redux Basket State
          • Basket Page - View
        • Checkout
          • Redux Checkout State
          • View & Template Rendering
          • Masking & Validation
      • Theming & Styling
      • Widgets
      • SEO Management
      • Extending Project Zero
    • Next.js
      • Basic Setup
      • Deployment
      • Static Assets
      • Plugins
      • Widgets
      • Icons
      • Localization
      • SEO Management
      • Advanced Usage
      • Data Fetching
        • Client
          • Account
          • Address
          • Basket
          • Checkout
          • Misc
          • Product
          • User
          • Wishlist
        • Server
          • Category
          • Flat Page
          • List
          • Menu
          • Product
          • SEO
          • Special Page
          • Widget
  • App Maker
    • Setup Your Environment
    • Plugin Quickstart
    • Create Project
    • Setup Existing Project
    • Deploy Project
    • Users and Roles
    • Add Public Key
    • App Maker CLI
    • Create App on Stores
      • Creating App on Apple App Store
      • Creating App on Google Play Store
    • Mobile App Framework
      • Configuration
      • Framework
      • Project Structure
        • Structure
        • Data Containers
        • Pages
      • Dependency Integration
        • Plugins
        • Akinon Plugin Adapter
  • Akifast
    • HPP
      • Getting Started
      • Authorization
      • Payment Session Creation
        • Key Points Before Creating a Payment Session
        • Creating Payment Session
        • Redirecting to the Payment Page
        • Errors Encountered During Payment Session Creation
      • Merchant Services
        • Shipping Query URL
        • Agreement Query URL
        • Other URLs
  • B2B
    • Getting Started
    • B2B Setup
  • Adds-on
    • Invoicer
      • Introduction
      • Invoice & Pay On Delivery Service
  • Channel App Template
    • Introduction
    • Installation and Usage
    • Development Steps
      • Folder Structure
      • Starting Step
      • Encoding the Sales Channel
        • Introduction
        • Setup
        • Products
        • Product Price
        • Product Stock
        • Product Image
        • Orders
        • Product Data
      • Adding a New Command to Akinon
      • Listening for External Requests
    • Architecture
      • Introduction
      • Integration
      • Services (Flows)
        • Introduction
        • Product Service
        • Price Service
        • Stock Service
        • Image Service
        • Order Service
  • Multi Regional Settings
    • Multi Regional Settings
Powered by GitBook

© 2025 Akinon. All rights reserved.

On this page
  • Locales​
  • Adding a New Locale​
  • Default Locale​
  • Setting a Locale​
  • Disabling Redirection to Default Locale​
  • Currencies​
  • Adding a New Currency​
  • Default Currency​
  • Determining Active Currency​
  • URL Strategy​
  • Translations​
  • Localization in Components​
  • Client Components​
  • Server Components​

Was this helpful?

  1. Project Zero
  2. Next.js

Localization

Project Zero Next supports multiple languages and currencies, and all the necessary settings for language and currency management can be found within the settings.js file.

Locales​

Adding a New Locale​

To add a new locale to the project, follow these steps:

  1. Open the settings.js file.

  2. Locate the localization section.

  3. Inside the locales array, add a new object with the following properties:

Property
Description

label

A label that can be displayed on any page of the website.

value

The lowercase locale value in ISO 639-1 format or including the country code in ISO 3166-1 alpha-2 format.

localePath

Name of the locale's JSON translation file. For example, if the value is "en," the file should be placed in the public/locales/en directory.

apiValue

The value of the locale defined in Commerce.

rtl

A boolean value that specifies whether it is right-to-left, like Arabic.

Here's an example of adding a new locale:

localization: {
  locales: [
    {
      label: 'EN',
      value: 'en',
      localePath: 'en',
      apiValue: 'en-us',
      rtl: false,
    },
  ],
}

Default Locale​

The default locale for the project can be specified by using the defaultLocaleValue in the settings.js file. This value should match the "value" of one of the defined locales.

Setting a Locale​

To set a locale in the project, the setLocale method available in the useLocalization hook can be used. This method will automatically change the URL to reflect the selected locale.

Example of using setLocale:

const { setLocale } = useLocalization();

setLocale('en-us');

Disabling Redirection to Default Locale​

In some cases, like displaying a landing page on example.com/ while using the ShowAllLocales strategy, users are automatically redirected to URLs containing the default locale (e.g., example.com/en). To disable this redirection, set redirectToDefaultLocale to false in the settings.js file:

localization: {
  redirectToDefaultLocale: false,
}

Currencies​

Adding a New Currency​

To add a new currency to the project, follow these steps:

  1. Open the settings.js file.

  2. Locate the currencies section.

  3. Inside the currencies array, add a new object with the following properties:

    • label: The label for the currency (e.g., 'USD').

    • code: The code for the currency (e.g., 'usd').

Here's an example of adding a new currency:

currencies: [
  {
    label: 'USD',
    code: 'usd',
  },
]

Default Currency​

The default currency in the project can be specified by using the defaultCurrencyCode in the settings.js file. This code must match the "code" of one of the defined currencies.

Determining Active Currency​

The getActiveCurrencyCode function's default behavior is to retrieve the active currency code from a cookie named pz-currency. Users can customize this function to obtain the currency code from different sources, such as headers or the URL. If the return value doesn't match any currency code in the currencies array, the default currency code will be used.

Here's an example:

getActiveCurrencyCode: ({ req, locale, defaultCurrencyCode }) => {
  const [, countryCode] = locale.split('-');

  if (countryCode === 'ae') {
    return 'aed';
  } else if (countryCode === 'qa') {
    return 'qar';
  }

  return defaultCurrencyCode;
}

URL Strategy​

Project Zero Next supports multiple URL structures to cater to different requirements. Users can set the URL strategy using the localeUrlStrategy value in settings.js.

Example of setting the URL strategy:

localization: {
  localeUrlStrategy: LocaleUrlStrategy.ShowAllLocales,
}

The available values for localeUrlStrategy are:

  • LocaleUrlStrategy.HideDefaultLocale

  • LocaleUrlStrategy.HideAllLocales

  • LocaleUrlStrategy.ShowAllLocales

LocaleUrlStrategy.HideDefaultLocale:

  • For English (en): "/women"

  • For Turkish (tr): "/tr/women"

LocaleUrlStrategy.ShowAllLocales:

  • For English (en): "/en/women"

  • For Turkish (tr): "/tr/women"

LocaleUrlStrategy.HideAllLocales:

  • For English (en): "/women"

  • For Turkish (tr): "/women"

The "HideAllLocales" option is not recommended for SEO purposes.

Translations​

Translations can be managed by adding key-value pairs to JSON files located under the public/locales directory. For example, if the English (en) locale is used, translation files can be stored in public/locales/en/account.json.

Localization in Components​

Client Components​

The useLocalization hook provides all the necessary properties for localization in client components. To make use of translations in the client components, use the "t" function as shown in the example below:

import { useLocalization } from '@akinon/next/hooks';

const {
  t,
  currencies,
  currency,
  defaultCurrencyCode,
  locales,
  locale,
  defaultLocaleValue,
  localeUrlStrategy,
  setLocale,
} = useLocalization();

const translatedText = t('account.change_email.header.title');

Server Components​

For server components, the "t" function can be imported from the following path to access translations:

import { t } from '@akinon/next/utils/server-translation';

const translatedText = t('account.change_email.header.title');
PreviousIconsNextSEO Management

Last updated 23 days ago

Was this helpful?