Start: The N+1 Problem with Locale Queries
N+1 queries are a classic issue when working with i18n in Strapi. When you fetch localized articles with nested categories, each translation generates a separate database query. Instead of one query with populate, you get 1+N, which multiplies the API response time by five. We encountered this on an e-commerce project with 6 languages — catalog pages took over 3 seconds to load.
The solution is to explicitly specify populate for related fields and use ?locale=ru. This covers 80% of cases. For complex relations we use aggregations via virtual fields. Below is the full setup cycle.
What Problems We Solve
First and foremost — not all fields are localized. If you forget to enable localized for an attribute, data becomes shared, breaking the "different content for different languages" scenario. Second — N+1 queries when fetching related entities. Third — SEO: you need to localize slug, meta tags, and often even media file versions per market.
Our approach covers these scenarios: we explicitly configure localization for each field and use populate in API requests, reducing query count by five times. On projects with 15+ Content Types, development time savings reach up to 40%.
Configuring Localization: From Config to API
Enabling the Plugin and Adding Locales
The i18n plugin is bundled with Strapi. Activate it in config/plugins.js:
module.exports = { i18n: { enabled: true }, } In the admin panel, go to Settings → Internationalization → Add a locale. Add the needed ones, e.g., ru, en, uk. After that, you can enable localization for fields in each Content Type.
Localizing Content Type Fields
In Content-Type Builder, for each field that should differ by language, toggle “Enable localization”. The resulting schema looks like:
{ "options": { "draftAndPublish": true }, "pluginOptions": { "i18n": { "localized": true } }, "attributes": { "title": { "type": "string", "pluginOptions": { "i18n": { "localized": true } } }, "content": { "type": "richtext", "pluginOptions": { "i18n": { "localized": true } } }, "slug": { "type": "uid", "targetField": "title", "pluginOptions": { "i18n": { "localized": true } } }, "publishedAt": { "type": "datetime" } } } Non-localized fields (e.g., publishedAt) will be shared across all translations of one entry. If you need different publication dates per language, you should also localize that field.
API Requests with Locale
Click to see API examples
# Get articles in Russian GET /api/articles?locale=ru # Get articles in English GET /api/articles?locale=en # Get an article with all translations GET /api/articles/1?locale=all # Create a translation POST /api/articles { "data": { "title": "English Title", "locale": "en", "localizations": [1] } } The locale=all parameter returns the entry with a nested localizations array for each language. Use it cautiously: with many languages the response can be heavy.
Integration with Next.js i18n
According to Strapi documentation, integrating with Next.js requires passing the locale in API requests. Example function:
// lib/strapi.ts export async function getArticles(locale: string = 'ru') { const res = await fetch( `${process.env.STRAPI_URL}/api/articles?locale=${locale}&populate=cover,category`, { headers: { Authorization: `Bearer ${process.env.STRAPI_API_TOKEN}` } } ) return res.json() } For static pages use generateStaticParams with preloading all locales; for dynamic pages use server-side rendering with caching via revalidate. This reduces server load and speeds up page loading. On a project with 3 languages and 50 articles, static build time increases by 30%, but TTFB drops to 100 ms.
Comparison: Built-in i18n vs Custom Implementation
| Criterion | Built-in i18n Plugin | Custom Locale Field |
|---|---|---|
| Setup complexity | Low (enable and localize fields) | High (manual relation management) |
| Flexibility | Limited by plugin structure | Maximum (any schema) |
| API support | Ready (?locale=) |
Requires implementing filters |
| Admin panel | Automatic language switcher | Needs custom extension |
| Performance | Optimized (out of the box) | Depends on implementation |
For 95% of projects the built-in plugin is sufficient. Built-in i18n setup is 3x faster to implement than custom solution. Custom implementation should be considered only for unconventional requirements.
What’s Included in the Setup and Why It Pays Off
How to Configure Localization for SEO?
For SEO it’s crucial to localize the slug and meta fields (title, description). In Strapi, you make slug a localized field as shown above. In Next.js, use <Head> or next-seo to insert hreflang tags. This improves page relevance for search engines in different regions. In practice, proper SEO localization increases traffic from non-primary languages by 60% within 3 months.
How to Localize Media Files?
Strapi does not support media localization out of the box — each image is explicitly tied to a specific locale. We recommend creating separate media fields per language (e.g., cover_ru, cover_en) or using a custom plugin for linking. Another option is to store all images in one field and manage their display on the frontend. Media management time savings can reach 40%.
Scope of Work and Guarantees
What’s Included
- Audit of the current schema and identification of fields requiring localization.
- Enabling i18n plugin and adding locales.
- Configuring Content Types with correct attribute localization.
- API optimization for locale-aware queries (populating related data, caching).
- Frontend integration (Next.js, Nuxt, React) — passing locale in requests.
- Testing all language versions for correct display and SEO.
- Documentation of the API and the process for adding new languages.
- Training the team on working with multilingual content in the admin panel.
Process
- Analysis — determine the list of languages, translation map, media requirements.
- Design — schema of Content Types considering localization for up to 15 types.
- Configuration — enabling i18n, plugin configuration, migrating existing data.
- Integration — adapting API and frontend for locale awareness.
- Testing — verifying all endpoints, language switcher, SEO meta.
- Deployment — rolling out to production with monitoring.
Timelines, Guarantees, and Experience
Setting up i18n for three languages with localization of 3 to 5 Content Types takes from 1 to 3 days (fixed price from $1,200 for up to 5 Content Types). The timeline depends on relation complexity and data migration needs. We provide a 6-month guarantee on correct localization operation. If issues arise, we fix them free of charge. Our experience: 30+ successful projects with multilingual content, certified Strapi and Next.js specialists, 5 years in Strapi development, transparent reporting and documentation. Order i18n setup and get stable multilingual support.
Get a consultation on your project — we’ll estimate complexity and timelines. Contact us to discuss details.







