apple_native_translate 0.1.1 copy "apple_native_translate: ^0.1.1" to clipboard
apple_native_translate: ^0.1.1 copied to clipboard

PlatformiOS

On-device text translation using Apple's Translation framework on iOS 18 and later, exposed to Flutter with a simple batch API and a safe fallback.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:apple_native_translate/apple_native_translate.dart';

void main() => runApp(const _App());

class _App extends StatefulWidget {
  const _App();
  @override
  State<_App> createState() => _AppState();
}

class _AppState extends State<_App> {
  String _out = '';

  Future<void> _run() async {
    final List<String>? r = await AppleNativeTranslate.translate(
      texts: <String>['秘伝の手羽先', '鳥の唐揚げ'],
      source: 'ja',
      target: 'en',
    );
    setState(() => _out = r?.join('\n') ?? '使えませんでした');
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              Text(_out),
              const SizedBox(height: 16),
              ElevatedButton(onPressed: _run, child: const Text('訳す')),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
140
points
--
downloads

Documentation

API reference

Publisher

verified publisher8-order.co.jp

On-device text translation using Apple's Translation framework on iOS 18 and later, exposed to Flutter with a simple batch API and a safe fallback.

Repository (GitHub)

License

MIT (license)

Dependencies

flutter

More

Packages that depend on apple_native_translate

Packages that implement apple_native_translate