Docs · Integrations · i18n
Documentation
Multilingual quick reference: how language is selected, where texts live, and how to export/update translations.
Set I18N_EXPORT_TOKEN to enable export in production.
Contents
Navigate through the core topics.
Quickstart
Add the widget to your site and start receiving conversations in one place.
1) Add script
Place this snippet before </head>. Replace YOUR_PUBLIC_KEY.
<script>
(function(w,d){
w.Tallker=w.Tallker||function(){(w.Tallker.q=w.Tallker.q||[]).push(arguments)};
var s=d.createElement('script'); s.async=1; s.src='https://tallker.com/widget.js';
d.head.appendChild(s);
})(window,document);
Tallker('init',{ key:'YOUR_PUBLIC_KEY' });
</script>
2) Verify
Open your site, send a test message, and confirm it appears in Tallker inbox.
Language detection
Priority: lang URL parameter → lang cookie → Accept-Language header → ru.
Strategy
- User choice is sticky (cookie for 180 days).
- Country mapping is optional (tk_country_lang).
- Accept-Language is a safe fallback for first visit.
Translation read
Load default language first and override with selected language.
$tr = load_translations($pdo, $lang, $defaultLang);
$t = fn($key,$fb='') => $tr[$key] ?? ($fb ?: $key);
echo $t('docs_h1','Documentation');
Translation keys
Keys for this page use the docs_ prefix. Keep keys stable to make updates safe.
Export & import
Export generates an SQL dump from tk_translations for the selected scope (docs or all).
Import
Use mysql client. Run in a transaction to keep consistency.
# import example
mysql -uUSER -p DBNAME < tk_translations.sql
Export
Production export should be protected with I18N_EXPORT_TOKEN.
# export (debug=1 OR token)
GET https://tallker.com/docs?export=sql&scope=docs&lang=ru&debug=1
GET https://tallker.com/docs?export=sql&scope=all&lang=en&token=YOUR_TOKEN
PHP usage example
Minimal pattern: detect language, load translations in one query, resolve strings via t('key').
<?php
$lang = $_GET['lang'] ?? 'ru';
$st = $pdo->prepare('SELECT tkey,tvalue FROM tk_translations WHERE lang=:lang');
$st->execute([':lang' => $lang]);
$bag = $st->fetchAll(PDO::FETCH_KEY_PAIR);
function t(array $bag, string $key, string $fallback=''): string {
return (isset($bag[$key]) && $bag[$key] !== '') ? $bag[$key] : ($fallback !== '' ? $fallback : $key);
}
echo t($bag,'docs_h1','Docs');
?>
Texts in DB
Below are rows for the selected scope and language. You can search by key.
| Key | Value | Updated |
|---|---|---|
| Apply | 2026-02-01 22:24:02 | |
| Export SQL | 2026-02-01 22:24:02 | |
| Minimal pattern: detect language, load translations in one query, resolve strings via t('key'). | 2026-02-01 22:24:02 | |
| PHP usage example | 2026-02-01 22:24:02 | |
| Export generates an SQL dump from tk_translations for the selected scope (docs or all). | 2026-02-01 22:24:02 | |
| For production protection set I18N_EXPORT_TOKEN and pass token in the URL. | 2026-02-01 22:24:02 | |
| Export & import | 2026-02-01 22:24:02 | |
| Documentation | 2026-02-01 22:24:02 | |
| Priority: lang URL parameter → lang cookie → Accept-Language header → ru. | 2026-02-01 22:24:02 | |
| Supported languages by default: ru, en, de, fr, es, tr. | 2026-02-01 22:24:02 | |
| Language detection | 2026-02-01 22:24:02 | |
| Keys for this page use the docs_ prefix. Keep keys stable to make updates safe. | 2026-02-01 22:24:02 | |
| Recommendation: encode intent in the key (e.g., docs_btn_export, docs_overview_p1). | 2026-02-01 22:24:02 | |
| Translation keys | 2026-02-01 22:24:02 | |
| Language | 2026-02-01 22:24:02 | |
| Multilingual quick reference: how language is selected, where texts live, and how to export/update translations. | 2026-02-01 22:24:02 | |
| Tallker translation system docs: key structure, language detection, export/import. | 2026-02-01 22:24:02 | |
| Documentation — Tallker | 2026-02-01 22:24:02 | |
| Texts are stored in the tk_translations table (lang, tkey, tvalue). | 2026-02-01 22:24:02 | |
| The /docs page uses fallback order: selected language → EN → RU. This prevents empty strings in UI. | 2026-02-01 22:24:02 | |
| Overview | 2026-02-01 22:24:02 | |
| All texts | 2026-02-01 22:24:02 | |
| Only /docs | 2026-02-01 22:24:02 | |
| Scope | 2026-02-01 22:24:02 | |
| Search by key… | 2026-02-01 22:24:02 | |
| Need a new language? Add it to tk_languages and fill tk_translations. No code changes required. | 2026-02-01 22:24:02 | |
| Support | 2026-02-01 22:24:02 | |
| No rows for the current filter. | 2026-02-01 22:24:02 | |
| Below are rows for the selected scope and language. You can search by key. | 2026-02-01 22:24:02 | |
| Key | 2026-02-01 22:24:02 | |
| Value | 2026-02-01 22:24:02 | |
| Texts in DB | 2026-02-01 22:24:02 |
Support
Need a new language? Add it to tk_languages and fill tk_translations. No code changes required.