update template
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package webextension_polyfill.i18n;
|
||||
|
||||
/**
|
||||
LanguageDetectionResult object that holds detected langugae reliability and array of DetectedLanguage
|
||||
**/
|
||||
typedef DetectLanguageCallbackResultType = {
|
||||
/**
|
||||
CLD detected language reliability
|
||||
**/
|
||||
var isReliable : Bool;
|
||||
/**
|
||||
array of detectedLanguage
|
||||
**/
|
||||
var languages : Array<DetectLanguageCallbackResultTypeLanguagesItemType>;
|
||||
};
|
@@ -0,0 +1,12 @@
|
||||
package webextension_polyfill.i18n;
|
||||
|
||||
/**
|
||||
DetectedLanguage object that holds detected ISO language code and its percentage in the input string
|
||||
**/
|
||||
typedef DetectLanguageCallbackResultTypeLanguagesItemType = {
|
||||
var language : String;
|
||||
/**
|
||||
The percentage of the detected language
|
||||
**/
|
||||
var percentage : Float;
|
||||
};
|
@@ -0,0 +1,9 @@
|
||||
package webextension_polyfill.i18n;
|
||||
|
||||
/**
|
||||
An ISO language code such as <code>en</code> or <code>fr</code>. For a complete list of languages supported by this
|
||||
method, see <a href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc'>
|
||||
kLanguageInfoTable</a>. For an unknown language, <code>und</code> will be returned, which means that [percentage]
|
||||
of the text is unknown to CLD
|
||||
**/
|
||||
typedef LanguageCode = String;
|
25
template/externs/webextension_polyfill/i18n/Static.hx
Normal file
25
template/externs/webextension_polyfill/i18n/Static.hx
Normal file
@@ -0,0 +1,25 @@
|
||||
package webextension_polyfill.i18n;
|
||||
|
||||
typedef Static = {
|
||||
/**
|
||||
Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale,
|
||||
use $(ref:i18n.getUILanguage).
|
||||
**/
|
||||
function getAcceptLanguages():js.lib.Promise<Array<String>>;
|
||||
/**
|
||||
Gets the localized string for the specified message. If the message is missing, this method returns an empty string ('').
|
||||
If the format of the <code>getMessage()</code> call is wrong — for example, <em>messageName</em>
|
||||
is not a string or the <em>substitutions</em> array has more than 9 elements — this method returns <code>
|
||||
undefined</code>.
|
||||
**/
|
||||
function getMessage(messageName:String, ?substitutions:ts.AnyOf2<String, Array<String>>):String;
|
||||
/**
|
||||
Gets the browser UI language of the browser. This is different from $(ref:i18n.getAcceptLanguages)
|
||||
which returns the preferred user languages.
|
||||
**/
|
||||
function getUILanguage():String;
|
||||
/**
|
||||
Detects the language of the provided text using CLD.
|
||||
**/
|
||||
function detectLanguage(text:String):js.lib.Promise<DetectLanguageCallbackResultType>;
|
||||
};
|
Reference in New Issue
Block a user