MLKitTranslate 框架参考
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
MLKTranslatorOptions
@interface MLKTranslatorOptions : NSObject
“Translator
”的选项。
-
-
-
参数
sourceLanguage
|
|
targetLanguage
|
|
返回值
采用指定源语言和目标语言的新 TranslatorOptions
实例。
-
不可用。请改用 init(sourceLanguage:targetLanguage:)
。
声明
Objective-C
- (nonnull instancetype)init;
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003e\u003ccode\u003eMLKTranslatorOptions\u003c/code\u003e configures the source and target languages for translation using \u003ccode\u003eMLKTranslator\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt requires specifying both source and target languages during initialization using \u003ccode\u003einitWithSourceLanguage:targetLanguage:\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eDirect initialization using \u003ccode\u003einit\u003c/code\u003e is unavailable; always use the designated initializer.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esourceLanguage\u003c/code\u003e and \u003ccode\u003etargetLanguage\u003c/code\u003e properties provide read-only access to the configured language settings.\u003c/p\u003e\n"]]],[],null,["# MLKitTranslate Framework Reference\n\nMLKTranslatorOptions\n====================\n\n\n @interface MLKTranslatorOptions : NSObject\n\nOptions for `Translator`.\n- `\n ``\n ``\n `\n\n ### [sourceLanguage](#/c:objc(cs)MLKTranslatorOptions(py)sourceLanguage)\n\n `\n ` \n The source language of the input. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) ../Type-Definitions.html#/c:MLKTranslateLanguage.h@T@MLKTranslateLanguage _Nonnull sourceLanguage;\n\n- `\n ``\n ``\n `\n\n ### [targetLanguage](#/c:objc(cs)MLKTranslatorOptions(py)targetLanguage)\n\n `\n ` \n The target language to translate the input into. \n\n #### Declaration\n\n Objective-C \n\n @property (nonatomic, readonly) ../Type-Definitions.html#/c:MLKTranslateLanguage.h@T@MLKTranslateLanguage _Nonnull targetLanguage;\n\n- `\n ``\n ``\n `\n\n ### [-initWithSourceLanguage:targetLanguage:](#/c:objc(cs)MLKTranslatorOptions(im)initWithSourceLanguage:targetLanguage:)\n\n `\n ` \n Creates a new instance of translator options with the given source and target languages. \n\n #### Declaration\n\n Objective-C \n\n - (nonnull instancetype)\n initWithSourceLanguage:(nonnull ../Type-Definitions.html#/c:MLKTranslateLanguage.h@T@MLKTranslateLanguage)sourceLanguage\n targetLanguage:(nonnull ../Type-Definitions.html#/c:MLKTranslateLanguage.h@T@MLKTranslateLanguage)targetLanguage;\n\n #### Parameters\n\n |------------------------|-----------------------------------------|\n | ` `*sourceLanguage*` ` | The source language for the translator. |\n | ` `*targetLanguage*` ` | The target language for the translator. |\n\n #### Return Value\n\n A new instance of `TranslatorOptions` with the given source and target language.\n- `\n ``\n ``\n `\n\n ### [-init](#/c:objc(cs)MLKTranslatorOptions(im)init)\n\n `\n ` \n Unavailable. Use `init(sourceLanguage:targetLanguage:)` instead. \n\n #### Declaration\n\n Objective-C \n\n - (nonnull instancetype)init;"]]