goodjob_language 1.0.2+1 copy "goodjob_language: ^1.0.2+1" to clipboard
goodjob_language: ^1.0.2+1 copied to clipboard

outdated

Goodjob-SDK是为了满足国际化翻译,实现了一键配置翻译结果同步到应用上,使开发者在开发过程中不再需要关注于文案的翻译和撰写,能将更大的精力放在研发上。

账号注册及申请 #

1.登陆 https://goodjob.ai/ 申请成为开发者

2.面板栏选择创建新项目

图片

3.个人中心查看生成的 apiKey 和 apiSecret.

SDK-Flutter集成 #

集成方式 #

dependencies:
  goodjob_language: ^latest_version

功能使用 #

  1. 初始化 sdk
GoodJobBusiness _business = GoodJobBusiness.getInstance();
var res =  await _business.initSDK(
     apiKey: "goodjob_api_key",
     apiSecret: "goodjob_api_secret",
     id: '10133',
     isDebug: true);
    
  1. 获取翻译结果

keyName需要和 goodjob 配置的名称一一对应,如需修改请在后台操作,默认中文

var res = await _business.interpret(keyName);
  1. 切换语言
_business.switchLanguage(language: lang);
  1. 获取已添加语言列表
_business.getLanguageList();

其它功能 #

如果想控制全局状态的变更,建议本地手动导入 provider 库

dependencies:
  provider: ^4.0.5

文档provider官方文档 https://pub.dev/packages/provider

example以4.0.5为例:

  1. 定义 Counter 文件
class Counter with ChangeNotifier,DiagnosticableTreeMixin{
  String _key10 = "";
  String get key10 => _key10;
  void initCounter({String lang}) async {
    GoodJobBusiness _business = GoodJobBusiness.getInstance();
    if (lang != null) {
      _business.switchLanguage(language: lang);
    }
    _key10 = await _business.interpret("key10");
    notifyListeners();
  }  
}
  1. 修改 main 中 App 入口
void main() {
  runApp(MultiProvider(
    providers: [
      ChangeNotifierProvider(create: (_) => Counter()),
    ],
    child: MyApp(),
  ));
}
  1. 使用
Text('${Provider.of<Counter>(context).key10}')
5
likes
0
pub points
0%
popularity

Publisher

verified publishergoodjob.ai

Goodjob-SDK是为了满足国际化翻译,实现了一键配置翻译结果同步到应用上,使开发者在开发过程中不再需要关注于文案的翻译和撰写,能将更大的精力放在研发上。

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

crypto, dio, dio_http_cache, flutter, path, quiver, sqflite

More

Packages that depend on goodjob_language