PhoenixKitAI.Translatables (PhoenixKitAI v0.6.0)

Copy Markdown View Source

Discovery for AI-translatable adapters.

A feature module opts a resource into AI translation by exporting ai_translatables/0 returning [{resource_type, adapter_module}], where adapter_module implements PhoenixKitAI.Translatable. This scans every module known to PhoenixKit.ModuleRegistry for that function (duck-typed — the function is not a PhoenixKit.Module callback, so feature modules declare AI-translatability without core knowing anything about AI).

resource_type strings must be globally unique; on a collision the first registered module wins.

Summary

Functions

%{resource_type => adapter_module} for every registered module that exports ai_translatables/0.

Resolve the adapter for a resource_type, or nil.

Functions

all()

@spec all() :: %{required(String.t()) => module()}

%{resource_type => adapter_module} for every registered module that exports ai_translatables/0.

find(resource_type)

@spec find(String.t()) :: module() | nil

Resolve the adapter for a resource_type, or nil.