draftTemplate method
Implementation
Future<String> draftTemplate(String baseText, String locale, String language,
String axisDesc, Set<String> placeholders) {
final ph = placeholders.isEmpty
? '(none)'
: (placeholders.toList()..sort()).map((p) => '{$p}').join(', ');
final axisLine =
axisDesc.isNotEmpty ? 'Variant to produce: $axisDesc\n' : '';
final prompt = '''Produce one UI string for a mobile/web app.
Target locale: $locale
Target language: $language
Base English text: $baseText
Placeholders that MUST be preserved exactly: $ph
$axisLine
Rules:
- Return ONLY the final string, nothing else.
- Preserve every placeholder exactly, e.g. {count}, {name}.
- Word the sentence naturally for the given variant (gender / plural form).
- Keep brand names unchanged. Do not add quotes.''';
return _call(prompt);
}