### Full i18n Application Example in Lua Source: https://context7.com/kikito/i18n.lua/llms.txt A comprehensive example showcasing multiple features of the i18n.lua library within a simulated application context. It includes loading translations for multiple languages, setting fallback locales, switching locales, and handling dynamic content and fallbacks. ```lua local i18n = require 'i18n' -- Initialize with complete translation set i18n.load({ en = { app = { title = 'Task Manager', welcome = 'Welcome, %{username}!', logout = 'Log out' }, tasks = { one = 'You have %{count} task', other = 'You have %{count} tasks' }, status = 'Status: %{status} | Last login: %{time}', error = { not_found = 'Task not found', no_permission = 'You do not have permission' } }, es = { app = { title = 'Gestor de Tareas', welcome = '¡Bienvenido, %{username}!', logout = 'Cerrar sesión' }, tasks = { one = 'Tienes %{count} tarea', other = 'Tienes %{count} tareas' }, status = 'Estado: %{status} | Último acceso: %{time}', error = { not_found = 'Tarea no encontrada', no_permission = 'No tienes permiso' } }, fr = { app = { title = 'Gestionnaire de Tâches', welcome = 'Bienvenue, %{username}!', logout = 'Se déconnecter' }, tasks = { one = 'Vous avez %{count} tâche', other = 'Vous avez %{count} tâches' } } }) -- Set English as fallback i18n.setFallbackLocale('en') -- Simulate user selecting Spanish i18n.setLocale('es') -- Render UI local userData = {username = 'María', taskCount = 3} print(i18n('app.title')) -- "Gestor de Tareas" print(i18n('app.welcome', {username = userData.username})) -- "¡Bienvenido, María!" print(i18n('tasks', {count = userData.taskCount})) -- "Tienes 3 tareas" print(i18n('status', {status = 'active', time = '2025-11-07 10:30'})) -- "Estado: active | Último acceso: 2025-11-07 10:30" -- Error handling with fallback print(i18n('error.not_found')) -- "Tarea no encontrada" -- Switch to French (incomplete translations will fallback to English) i18n.setLocale('fr') print(i18n('app.title')) -- "Gestionnaire de Tâches" print(i18n('tasks', {count = 1})) -- "Vous avez 1 tâche" print(i18n('error.not_found')) -- "Task not found" (fallback to English) -- Override locale temporarily for a specific translation print(i18n('app.logout', {locale = 'en'})) -- "Log out" ``` -------------------------------- ### Initialize and Load Translations in Lua Source: https://github.com/kikito/i18n.lua/blob/master/README.md Demonstrates basic setup of the i18n library, including setting translations, loading from tables, and loading from external files. Shows how to set locale and retrieve translations with and without parameters. ```lua i18n = require 'i18n' -- loading stuff i18n.set('en.welcome', 'welcome to this program') i18n.load({ en = { good_bye = "good-bye!", age_msg = "your age is %{age}.", phone_msg = { one = "you have one new message.", other = "you have %{count} new messages." } } }) i18n.loadFile('path/to/your/project/i18n/de.lua') -- load German language file i18n.loadFile('path/to/your/project/i18n/fr.lua') -- load French language file … -- section 'using language files' below describes structure of files -- setting the translation context i18n.setLocale('en') -- English is the default locale anyway -- getting translations i18n.translate('welcome') -- Welcome to this program i18n('welcome') -- Welcome to this program i18n('age_msg', {age = 18}) -- Your age is 18. i18n('phone_msg', {count = 1}) -- You have one new message. i18n('phone_msg', {count = 2}) -- You have 2 new messages. i18n('good_bye') -- Good-bye! ``` -------------------------------- ### Loading Translations from Files Source: https://context7.com/kikito/i18n.lua/llms.txt This section explains how to load translation data from external Lua files, providing an example file structure. ```APIDOC ## Loading Translations from Files ### Description This section explains how to load translation data from external Lua files, providing an example file structure. ### Method POST ### Endpoint N/A (Library Functions) ### Parameters #### Path Parameters - N/A #### Query Parameters - N/A #### Request Body - N/A ### Request Example N/A ### Response #### Success Response (200) - N/A #### Response Example N/A ```lua local i18n = require 'i18n' -- Load from external files i18n.loadFile('i18n/en.lua') i18n.loadFile('i18n/de.lua') i18n.loadFile('i18n/fr.lua') i18n.setLocale('de') local message = i18n('welcome') ``` Example file structure for `i18n/de.lua`: ```lua -- i18n/de.lua return { de = { welcome = "Willkommen", goodbye = "Auf Wiedersehen!", age_msg = "Ihr Alter beträgt %{age}.", phone_msg = { one = "Sie haben eine neue Nachricht.", other = "Sie haben %{count} neue Nachrichten." } } } ``` ``` -------------------------------- ### Combined Translations File in Lua Source: https://github.com/kikito/i18n.lua/blob/master/README.md Example of a single file containing translations for multiple languages. This approach can simplify deployment but may become unwieldy for large projects with many translations. ```lua return { de = { good_bye = "Auf Wiedersehen!", age_msg = "Ihr Alter beträgt %{age}.", phone_msg = { one = "Sie haben eine neue Nachricht.", other = "Sie haben %{count} neue Nachrichten." } }, fr = { good_bye = "Au revoir !", age_msg = "Vous avez %{age} ans.", phone_msg = { one = "Vous avez une noveau message.", other = "Vous avez %{count} noveaux messages." } }, … } ``` -------------------------------- ### Basic Translation Setup and Retrieval Source: https://context7.com/kikito/i18n.lua/llms.txt This section describes how to set and retrieve translations using dot-notation keys with locale prefixes. It demonstrates setting individual translations and changing the current locale to retrieve localized strings. ```APIDOC ## Basic Translation Setup and Retrieval ### Description This section describes how to set and retrieve translations using dot-notation keys with locale prefixes. It demonstrates setting individual translations and changing the current locale to retrieve localized strings. ### Method GET ### Endpoint N/A (Library Functions) ### Parameters #### Path Parameters - N/A #### Query Parameters - N/A #### Request Body - N/A ### Request Example N/A ### Response #### Success Response (200) - N/A #### Response Example N/A ```lua local i18n = require 'i18n' -- Set individual translation strings i18n.set('en.welcome', 'Welcome to this program') i18n.set('en.goodbye', 'Good-bye!') i18n.set('es.welcome', 'Bienvenido a este programa') i18n.set('es.goodbye', '¡Adiós!') -- Set the current locale i18n.setLocale('en') -- Retrieve translations (both forms work) local msg1 = i18n.translate('welcome') -- "Welcome to this program" local msg2 = i18n('goodbye') -- "Good-bye!" (shorthand via metatable) -- Change locale i18n.setLocale('es') local msg3 = i18n('welcome') -- "Bienvenido a este programa" ``` ``` -------------------------------- ### German Language File Structure in Lua Source: https://github.com/kikito/i18n.lua/blob/master/README.md Example of how to structure a language file for German translations. The file returns a table with locale-specific translations that can be loaded by the i18n library. ```lua return { de = { good_bye = "Auf Wiedersehen!", age_msg = "Ihr Alter beträgt %{age}.", phone_msg = { one = "Sie haben eine neue Nachricht.", other = "Sie haben %{count} neue Nachrichten." } } } ``` -------------------------------- ### Loading Translations from Files - Lua Source: https://context7.com/kikito/i18n.lua/llms.txt Demonstrates loading translation data from external Lua files using i18n.loadFile(). This is useful for organizing translations into separate files. ```Lua local i18n = require 'i18n' -- Load from external files i18n.loadFile('i18n/en.lua') i18n.loadFile('i18n/de.lua') i18n.loadFile('i18n/fr.lua') i18n.setLocale('de') local message = i18n('welcome') ``` -------------------------------- ### Set and Retrieve Translations - Lua Source: https://context7.com/kikito/i18n.lua/llms.txt Demonstrates setting individual translation strings and retrieving them using dot-notation keys with locale prefixes. This allows managing translations through key-value stores and changing locales dynamically. ```Lua local i18n = require 'i18n' -- Set individual translation strings i18n.set('en.welcome', 'Welcome to this program') i18n.set('en.goodbye', 'Good-bye!') i18n.set('es.welcome', 'Bienvenido a este programa') i18n.set('es.goodbye', '¡Adiós!') -- Set the current locale i18n.setLocale('en') -- Retrieve translations (both forms work) local msg1 = i18n.translate('welcome') -- "Welcome to this program" local msg2 = i18n('goodbye') -- "Good-bye!" (shorthand via metatable) -- Change locale i18n.setLocale('es') local msg3 = i18n('welcome') -- "Bienvenido a este programa" ``` -------------------------------- ### Lua: French Pluralization (Fractional Numbers) Source: https://context7.com/kikito/i18n.lua/llms.txt Demonstrates French pluralization rules that treat zero, one, and fractional numbers up to two as singular. This requires specific handling for grammatical correctness. ```lua local i18n = require 'i18n' i18n.load({ fr = { items = { one = "%{count} chose", other = "%{count} choses" } } }) i18n.setLocale('fr') -- French treats 0, 1, and fractional numbers up to 2 as singular print(i18n('items', {count = 0})) -- "0 chose" (one) print(i18n('items', {count = 1})) -- "1 chose" (one) print(i18n('items', {count = 1.5})) -- "1.5 chose" (one) print(i18n('items', {count = 1.99})) -- "1.99 chose" (one) print(i18n('items', {count = 2})) -- "2 choses" (other) print(i18n('items', {count = 3})) -- "3 choses" (other) ``` -------------------------------- ### Load Individual Language Files in Lua Source: https://github.com/kikito/i18n.lua/blob/master/README.md Shows how to organize translations in separate language files and load them using the loadFile method. This approach helps maintain cleaner code organization for projects with many translations. ```lua … i18n.loadFile('path/to/your/project/i18n/de.lua') -- German translation i18n.loadFile('path/to/your/project/i18n/en.lua') -- English translation i18n.loadFile('path/to/your/project/i18n/fr.lua') -- French translation … ``` -------------------------------- ### Batch Loading Translations Source: https://context7.com/kikito/i18n.lua/llms.txt This section demonstrates how to load multiple translations at once using nested table structures, supporting different languages and nested messages. ```APIDOC ## Batch Loading Translations ### Description This section demonstrates how to load multiple translations at once using nested table structures, supporting different languages and nested messages. ### Method POST ### Endpoint N/A (Library Functions) ### Parameters #### Path Parameters - N/A #### Query Parameters - N/A #### Request Body - N/A ### Request Example N/A ### Response #### Success Response (200) - N/A #### Response Example N/A ```lua local i18n = require 'i18n' -- Load translations for multiple languages at once i18n.load({ en = { hello = 'Hello!', goodbye = 'Good-bye!', age_msg = 'Your age is %{age}.', nested = { message = 'This is a nested message', deeper = { value = 'Deep nested value' } } }, es = { hello = '¡Hola!', goodbye = '¡Adiós!', age_msg = 'Tu edad es %{age}.', nested = { message = 'Este es un mensaje anidado' } }, fr = { hello = 'Bonjour!', goodbye = 'Au revoir!' } }) i18n.setLocale('en') print(i18n('hello')) -- "Hello!" print(i18n('nested.message')) -- "This is a nested message" print(i18n('nested.deeper.value')) -- "Deep nested value" i18n.setLocale('es') print(i18n('hello')) -- "¡Hola!" ``` ``` -------------------------------- ### Variable Interpolation (Named Variables) Source: https://context7.com/kikito/i18n.lua/llms.txt Demonstrates how to interpolate named variables into translation strings using the %{name} syntax. ```APIDOC ## Variable Interpolation (Named Variables) ### Description Demonstrates how to interpolate named variables into translation strings using the %{name} syntax. ### Method GET ### Endpoint N/A (Library Functions) ### Parameters #### Path Parameters - N/A #### Query Parameters - N/A #### Request Body - N/A ### Request Example N/A ### Response #### Success Response (200) - N/A #### Response Example N/A ```lua local i18n = require 'i18n' i18n.load({ en = { greeting = 'Hello %{name}!', user_info = 'User %{username} is %{age} years old and lives in %{city}.', score = '%{player} scored %{points} points in %{game}.' } }) i18n.setLocale('en') -- Simple interpolation local msg1 = i18n('greeting', {name = 'Alice'}) -- Result: "Hello Alice!" -- Multiple variables local msg2 = i18n('user_info', { username = 'john_doe', age = 28, city = 'New York' }) -- Result: "User john_doe is 28 years old and lives in New York." -- Interpolation with numbers and strings local msg3 = i18n('score', { player = 'Sarah', points = 9500, game = 'Championship Finals' }) -- Result: "Sarah scored 9500 points in Championship Finals." ``` ``` -------------------------------- ### Batch Loading Translations - Lua Source: https://context7.com/kikito/i18n.lua/llms.txt Shows how to load multiple translations at once using nested table structures. Supports loading translations for different languages and nested messages. ```Lua local i18n = require 'i18n' -- Load translations for multiple languages at once i18n.load({ en = { hello = 'Hello!', goodbye = 'Good-bye!', age_msg = 'Your age is %{age}.', nested = { message = 'This is a nested message', deeper = { value = 'Deep nested value' } } }, es = { hello = '¡Hola!', goodbye = '¡Adiós!', age_msg = 'Tu edad es %{age}.', nested = { message = 'Este es un mensaje anidado' } }, fr = { hello = 'Bonjour!', goodbye = 'Au revoir!' } }) i18n.setLocale('en') print(i18n('hello')) -- "Hello!" print(i18n('nested.message')) -- "This is a nested message" print(i18n('nested.deeper.value')) -- "Deep nested value" i18n.setLocale('es') print(i18n('hello')) -- "¡Hola!" ``` -------------------------------- ### Lua: Variable Interpolation with Format Specifiers Source: https://context7.com/kikito/i18n.lua/llms.txt Demonstrates advanced string interpolation in Lua using named variables and format specifiers (e.g., %s, %d, %.2f). This allows for flexible and type-aware string construction. ```lua local i18n = require 'i18n' i18n.load({ en = { advanced = 'User: %s, Age: %d, Balance: $%.2f', octal_demo = 'Name: %.q, Age: %.d (octal: %.o)', scientific = 'Value: %.2f (scientific: %.e)' } }) i18n.setLocale('en') -- Combined format with type specifiers local msg1 = i18n('advanced', { name = 'John', age = 30, balance = 1234.5 }) -- Result: "User: John, Age: 30, Balance: $1234.50" local msg2 = i18n('octal_demo', { name = 'Alice', age = 10 }) -- Result: "Name: Alice, Age: 10 (octal: 12)" local msg3 = i18n('scientific', {num = 12345.67}) -- Result: "Value: 12345.67 (scientific: 1.234567e+04)" ``` -------------------------------- ### Pluralization with Unicode Rules in Lua Source: https://github.com/kikito/i18n.lua/blob/master/README.md Demonstrates how to implement pluralization using Unicode CLDR rules. Shows how locale settings affect plural forms and how to handle different plural categories like 'one', 'few', 'many', and 'other'. ```lua i18n = require 'i18n' i18n.load({ en = { msg = { one = "one message", other = "%{count} messages" } }, ru = { msg = { one = "1 сообщение", few = "%{count} сообщения", many = "%{count} сообщений", other = "%{count} сообщения" } } }) i18n('msg', {count = 1}) -- one message i18n.setLocale('ru') i18n('msg', {count = 5}) -- 5 сообщений ``` -------------------------------- ### Variable Interpolation (Traditional Lua Format) Source: https://context7.com/kikito/i18n.lua/llms.txt This section illustrates variable interpolation using traditional Lua string.format style interpolation with positional arguments. ```APIDOC ## Variable Interpolation (Traditional Lua Format) ### Description This section illustrates variable interpolation using traditional Lua string.format style interpolation with positional arguments. ### Method GET ### Endpoint N/A (Library Functions) ### Parameters #### Path Parameters - N/A #### Query Parameters - N/A #### Request Body - N/A ### Request Example N/A ### Response #### Success Response (200) - N/A #### Response Example N/A ```lua local i18n = require 'i18n' i18n.load({ en = { traditional = 'Player %d finished in %s place', formatted = 'Temperature: %.2f°C, Humidity: %d%%', mixed = 'Result: %s with value %d' } }) i18n.setLocale('en') -- Traditional Lua format with array-style parameters local msg1 = i18n('traditional', {1, 'first'}) -- Result: "Player 1 finished in first place" local msg2 = i18n('formatted', {23.456, 65}) -- Result: "Temperature: 23.46°C, Humidity: 65%" local msg3 = i18n('mixed', {"success", 42}) -- Result: "Result: success with value 42" ``` ``` -------------------------------- ### Variable Interpolation (Named Variables) - Lua Source: https://context7.com/kikito/i18n.lua/llms.txt Shows how to interpolate named variables into translation strings using the %{name} syntax, allowing for dynamic content in translations. ```Lua local i18n = require 'i18n' i18n.load({ en = { greeting = 'Hello %{name}!', user_info = 'User %{username} is %{age} years old and lives in %{city}.', score = '%{player} scored %{points} points in %{game}.' } }) i18n.setLocale('en') -- Simple interpolation local msg1 = i18n('greeting', {name = 'Alice'}) -- Result: "Hello Alice!" -- Multiple variables local msg2 = i18n('user_info', { username = 'john_doe', age = 28, city = 'New York' }) -- Result: "User john_doe is 28 years old and lives in New York." -- Interpolation with numbers and strings local msg3 = i18n('score', { player = 'Sarah', points = 9500, game = 'Championship Finals' }) -- Result: "Sarah scored 9500 points in Championship Finals." ``` -------------------------------- ### Variable Interpolation in Lua Translations Source: https://github.com/kikito/i18n.lua/blob/master/README.md Shows multiple methods for interpolating variables in translated strings, including named placeholders, indexed placeholders, and combined formatting options. ```lua -- the most usual one i18n.set('variables', 'Interpolating variables: %{name} %{age}') i18n('variables', {name='john', age=10}) -- Interpolating variables: john 10 i18n.set('lua', 'Traditional Lua way: %d %s') i18n('lua', {1, 'message'}) -- Traditional Lua way: 1 message i18n.set('combined', 'Combined: %.q %.d %.o') i18n('combined', {name='john', age=10}) -- Combined: john 10 12k ``` -------------------------------- ### Variable Interpolation (Traditional Lua Format) - Lua Source: https://context7.com/kikito/i18n.lua/llms.txt Demonstrates using traditional Lua string.format style interpolation with positional arguments for variable insertion into translations. ```Lua local i18n = require 'i18n' i18n.load({ en = { traditional = 'Player %d finished in %s place', formatted = 'Temperature: %.2f°C, Humidity: %d%%', mixed = 'Result: %s with value %d' } }) i18n.setLocale('en') -- Traditional Lua format with array-style parameters local msg1 = i18n('traditional', {1, 'first'}) -- Result: "Player 1 finished in first place" local msg2 = i18n('formatted', {23.456, 65}) -- Result: "Temperature: 23.46°C, Humidity: 65%" local msg3 = i18n('mixed', {"success", 42}) -- Result: "Result: success with value 42" ``` -------------------------------- ### Reset Translation Store in Lua Source: https://context7.com/kikito/i18n.lua/llms.txt Illustrates how to clear all loaded translations and reset the i18n library to its default state. This is useful for reinitializing the translation system or in testing scenarios. ```lua local i18n = require 'i18n' -- Load some translations i18n.load({ en = {hello = 'Hello'}, es = {hello = 'Hola'} }) i18n.setLocale('es') i18n.setFallbackLocale('en') print(i18n('hello')) -- "Hola" print(i18n.getLocale()) -- "es" print(i18n.getFallbackLocale()) -- "en" -- Reset everything to defaults i18n.reset() print(i18n.getLocale()) -- "en" (default) print(i18n.getFallbackLocale()) -- "en" (default) print(i18n('hello')) -- nil (translations cleared) -- Translations must be reloaded after reset i18n.set('en.welcome', 'Welcome back') print(i18n('welcome')) -- "Welcome back" ``` -------------------------------- ### Override Locale for Translations in Lua Source: https://context7.com/kikito/i18n.lua/llms.txt Demonstrates how to set translations for multiple locales and then override the default locale for individual translation lookups. This allows for dynamic language switching within the same application flow. ```lua local i18n = require 'i18n' i18n.load({ en = { greeting = 'Hello', status = 'Status' }, es = { greeting = 'Hola', status = 'Estado' }, fr = { greeting = 'Bonjour', status = 'Statut' } }) -- Set default locale i18n.setLocale('en') -- Use default locale print(i18n('greeting')) -- "Hello" -- Override locale for specific translations print(i18n('greeting', {locale = 'es'})) -- "Hola" print(i18n('greeting', {locale = 'fr'})) -- "Bonjour" print(i18n('status', {locale = 'es'})) -- "Estado" -- Default locale remains unchanged print(i18n('greeting')) -- "Hello" ``` -------------------------------- ### Lua: Locale Fallback Mechanism Source: https://context7.com/kikito/i18n.lua/llms.txt Explains and demonstrates the locale fallback mechanism in i18n.lua, allowing translations to cascade through locale ancestry and a designated fallback locale when a direct translation is not found. ```lua local i18n = require 'i18n' i18n.load({ en = { greeting = 'Hello', farewell = 'Goodbye', welcome = 'Welcome' }, en_US = { greeting = 'Howdy' -- US-specific override }, es = { greeting = 'Hola', farewell = 'Adiós' } }) -- Set fallback locale (used when translation not found in current locale) i18n.setFallbackLocale('en') -- Example 1: Locale with parent fallback i18n.setLocale('en-US') print(i18n('greeting')) -- "Howdy" (found in en-US) print(i18n('farewell')) -- "Goodbye" (not in en-US, falls back to en) print(i18n('welcome')) -- "Welcome" (not in en-US, falls back to en) -- Example 2: Unrelated locale with fallback i18n.setLocale('fr') print(i18n('greeting')) -- "Hello" (not in fr, uses fallback locale en) print(i18n('farewell')) -- "Goodbye" (not in fr, uses fallback locale en) -- Example 3: Default parameter when all else fails print(i18n('missing_key', {default = 'Not found'})) -- "Not found" print(i18n('another_missing')) -- nil (no default provided) ``` -------------------------------- ### Define Custom Pluralization Rules in Lua Source: https://context7.com/kikito/i18n.lua/llms.txt Shows how to implement and register a custom pluralization function for languages with unique grammatical rules. This function determines the correct translation key based on a given number. ```lua local i18n = require 'i18n' -- Custom pluralization function for a fictional language -- Returns different forms based on custom rules local function customPlural(n) if n == 0 then return "zero" elseif n == 1 then return "single" elseif n == 2 then return "double" elseif n < 10 then return "few" else return "many" end end -- Set locale with custom pluralization function i18n.setLocale('custom-lang', customPlural) i18n.load({ ['custom-lang'] = { items = { zero = "No items at all", single = "Just one item", double = "A pair of items", few = "A few items (%{count})", many = "Many items (%{count})" } } }) print(i18n('items', {count = 0})) -- "No items at all" print(i18n('items', {count = 1})) -- "Just one item" print(i18n('items', {count = 2})) -- "A pair of items" print(i18n('items', {count = 5})) -- "A few items (5)" print(i18n('items', {count = 15})) -- "Many items (15)" ``` -------------------------------- ### Lua: English Pluralization Source: https://context7.com/kikito/i18n.lua/llms.txt Implements automatic pluralization for English strings based on a 'count' variable. It supports 'one' and 'other' forms for singular and plural messages. ```lua local i18n = require 'i18n' i18n.load({ en = { messages = { one = "You have one message", other = "You have %{count} messages" }, items = { one = "One item in cart", other = "%{count} items in cart" }, files = { one = "%{count} file selected", other = "%{count} files selected" } } }) i18n.setLocale('en') -- Pluralization based on count print(i18n('messages', {count = 0})) -- "You have 0 messages" print(i18n('messages', {count = 1})) -- "You have one message" print(i18n('messages', {count = 2})) -- "You have 2 messages" print(i18n('messages', {count = 42})) -- "You have 42 messages" -- Default count is 1 print(i18n('items')) -- "One item in cart" print(i18n('files', {count = 1})) -- "1 file selected" print(i18n('files', {count = 5})) -- "5 files selected" ``` -------------------------------- ### Lua: Russian Pluralization (Complex Rules) Source: https://context7.com/kikito/i18n.lua/llms.txt Handles complex pluralization rules for Russian, which has multiple plural forms ('one', 'few', 'many', 'other'). This ensures correct grammatical agreement for varying counts. ```lua local i18n = require 'i18n' i18n.load({ ru = { messages = { one = "%{count} сообщение", -- 1, 21, 31, 41... few = "%{count} сообщения", -- 2-4, 22-24, 32-34... many = "%{count} сообщений", -- 0, 5-20, 25-30... other = "%{count} сообщения" } } }) i18n.setLocale('ru') print(i18n('messages', {count = 0})) -- "0 сообщений" (many) print(i18n('messages', {count = 1})) -- "1 сообщение" (one) print(i18n('messages', {count = 2})) -- "2 сообщения" (few) print(i18n('messages', {count = 5})) -- "5 сообщений" (many) print(i18n('messages', {count = 21})) -- "21 сообщение" (one) print(i18n('messages', {count = 22})) -- "22 сообщения" (few) print(i18n('messages', {count = 25})) -- "25 сообщений" (many) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.