This module provides a way to manage and translate strings in Drupal using a "keyword" philosophy. Developers can define keywords with optional default values, which then integrate with Drupal's core translation system for easy translation management.
A Drupal module for managing and translating strings using "Keyword" philosophy.
t('Drupal is great');
t('drupal.great');
In the first method, messages are written in the language of the default locale (English in this case). That message is then used as the "id" when creating translations.
In the second method, messages are actually "keywords" that convey the idea of the message. The keyword message is then used as the "id" for any translations. In this case, translations must be made for the default locale (i.e. to translate drupal.great to Drupal is great).
String enables developers to,
- define Keyword (i.e.
drupal.great) - optionally provide a default value
Drupal is great - integrate with core's translation api so that it works well with
tfunction, locale import/export, editing interface translation, etc.
Documentation
For detailed documentation, please visit our documentation site.
Quick Links
Support
Sample usage
Current (Core) Stringt('Dashboard')
t('dashboard.title')
t('My Dashboard')
t('user_dashboard.title')
t('Welcome @name!', ['@name' => $name])
t('dashboard.welcome_message.title', ['@name' => $name])
format_plural($count, '1 item', '@count items')
format_plural($count, 'search_result.item_count', 'search_result.item_count')
Depends on
Dependencies of the latest stable release
- locale Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 2.0.1 | Stable | 10–11 | Restore defaults when String default translator is reset | Oct 8, 2025 | |
| 2.0.0 | Stable | 10–11 | Correcting the mistakes made while releasing 1.2.0 | Aug 1, 2025 | |
| 2.x-dev | Dev | 10–11 | Initial fork from 1.x | Aug 1, 2025 | |
| 1.2.0 | Stable | 10–11 | Remove deprecated StringPluralTranslatableMarkup | Jul 11, 2025 | |
| 1.1.0 | Stable | 10–11 | Introduce a custom endpoint for i18next json v4 | May 14, 2025 | |
| 1.0.0 | Stable | 10–11 | First stable release | May 13, 2025 | |
| 1.x-dev | Dev | 10–11 | Dec 22, 2024 |