laratext 0.1.0

Laratext for Laravel Rust: translation keys with their source text, and auto-translation with OpenAI, Claude, Google Translate or Translatorio.
Documentation
use async_trait::async_trait;
use laratext::{TranslateError, Translated, Translator};

pub struct {{ class }};

#[async_trait]
impl Translator for {{ class }} {
    async fn translate(&self, text: &str, _from: &str, to: &[String]) -> Result<Translated, TranslateError> {
        // The scan passes every configured language in `to`, the source language `from` included, unless
        // this translator returns a number from `output_token_limit`. The bundled translators answer `from`
        // with `text` and never ask a service for it. Do the same, or the service is asked to translate a
        // language into itself, or a dictionary has no entry for it.

        // TODO: Implement your translation logic here.

        let mut results = Translated::new();

        for language in to {
            results.insert(language.clone(), text.to_owned()); // Dummy return same text
        }

        Ok(results)
    }
}