Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

INTRODUCTION

Wrapper for State API that handles states that variate per language.

The primary use case for this module is to store translatable variables without a content entity.

REQUIREMENTS

More than one language enabled.

CONFIGURATION

None, API-only module.

USAGE

Defines a new service multilingual_state that follows the same interface as the Drupal State service but gets/sets the variable with a language suffix.

When the current language is Spanish something like this can be executed:

\Drupal::service('multilingual_state')->set('site_title', 'Mi Drupal en espaƱol');
\Drupal::service('multilingual_state')->get('site_title');

And that variable can be different for each language.

There is three new methods:

// Specify the langcode explictly.
public function getTranslated($key, $langcode, $default = NULL);
public function setTranslated($key, $value, $langcode);

// Remove the variable from all languages.
public function deleteAllLanguages($key);

MAINTAINERS

Current maintainers for Drupal 11:

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Oct 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.0 Stable Oct 30, 2024
1.x-dev Dev Oct 30, 2024