registerTranslations method

void registerTranslations(
  1. TranslationRegistration registration
)

Register a feature's translation configuration

This should be called during feature initialization. The plugin will:

  1. Initialize the feature's translations with the current locale
  2. Register the callback for future locale changes

Implementation

void registerTranslations(TranslationRegistration registration) {
  _registrations.add(registration);

  vyuh.log.info(
      'LocalePlugin: Registered translations for "${registration.name}"');

  // Initialize with current locale (async to support deferred loading)
  Future.microtask(() async {
    try {
      await registration.onLocaleChange(currentLocale.value);
    } catch (e) {
      vyuh.log.error(
        'LocalePlugin: Error initializing "${registration.name}" translations: $e',
      );
    }
  });
}