Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(822)

Unified Diff: ios/web_view/public/cwv_language_detection_result.h

Issue 2839093002: Implemented new Translate API for purely Objective-C clients. (Closed)
Patch Set: Added some error handling. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/web_view/public/cwv_language_detection_result.h
diff --git a/ios/web_view/public/cwv_language_detection_result.h b/ios/web_view/public/cwv_language_detection_result.h
new file mode 100644
index 0000000000000000000000000000000000000000..f681a7f2cfdf27426cd283d5b5abb857b2ad0d76
--- /dev/null
+++ b/ios/web_view/public/cwv_language_detection_result.h
@@ -0,0 +1,35 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_WEB_VIEW_PUBLIC_CWV_LANGUAGE_DETECTION_RESULT_H
+#define IOS_WEB_VIEW_PUBLIC_CWV_LANGUAGE_DETECTION_RESULT_H
+
+#import <ChromeWebView/cwv_export.h>
+#import <Foundation/Foundation.h>
+
Eugene But (OOO till 7-30) 2017/04/26 20:15:30 Do you want to use nullability macro here?
jzw1 2017/04/27 04:54:01 Done.
+@class CWVTranslationLanguage;
+
+// Encapsulates the results of language detection in one class.
+CWV_EXPORT
+@interface CWVLanguageDetectionResult : NSObject
+
+- (instancetype)initWithSourceLanguage:(CWVTranslationLanguage*)sourceLanguage
Eugene But (OOO till 7-30) 2017/04/26 20:15:30 Does this method needs to be public? Client don't
jzw1 2017/04/27 04:54:01 moved to internal header file.
+ targetLanguage:(CWVTranslationLanguage*)targetLanguage
+ supportedLanguages:
+ (NSArray<CWVTranslationLanguage*>*)supportedLanguages
+ NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+// The detected page language.
+@property(nonatomic, readonly) CWVTranslationLanguage* sourceLanguage;
+// The assumed target language based on OS locale.
Eugene But (OOO till 7-30) 2017/04/26 20:15:30 Do you want to be more specific (f.e. say that thi
jzw1 2017/04/27 04:54:01 Done.
+@property(nonatomic, readonly) CWVTranslationLanguage* targetLanguage;
Eugene But (OOO till 7-30) 2017/04/26 20:15:30 Should this be something like, suggestedTranslatio
Hiroshi Ichikawa 2017/04/27 02:41:54 I believe suggestedTranslationLanguage is also amb
jzw1 2017/04/27 04:54:01 I will rename sourceLanguage to pageLanguage and t
Eugene But (OOO till 7-30) 2017/04/27 13:08:08 is targetLanguage always the same as OS language?
jzw1 2017/04/28 02:34:53 Internally it returns the first non empty lang in
Eugene But (OOO till 7-30) 2017/04/28 03:07:28 So looks like the fact that result will be OS lang
jzw1 2017/04/28 05:43:35 renamed to suggestedTranslationLanguage and update
Hiroshi Ichikawa 2017/04/28 05:50:06 As I told in earlier comment, I feel suggestedTran
+// The list of languages that can be used in translation.
Eugene But (OOO till 7-30) 2017/04/26 20:15:30 nit: "The list of supported languages that can be
jzw1 2017/04/27 04:54:01 Done.
+@property(nonatomic, readonly)
+ NSArray<CWVTranslationLanguage*>* supportedLanguages;
+
+@end
+
+#endif // IOS_WEB_VIEW_PUBLIC_CWV_LANGUAGE_DETECTION_RESULT_H

Powered by Google App Engine
This is Rietveld 408576698