|
This plugin contacts an API through JSON to obtain translations from selected rows. More...
Public Member Functions | |
| override void | OnStringTableItemContextMenu () |
Public Member Functions inherited from LocalizationEditorPlugin | |
| void | OnSave (BaseContainer stringTable, string stringTableItemClassName, string stringTableAbsPath) |
| void | OnChange (BaseContainer stringTableItem, string propName, string propValue) |
| void | OnImport (BaseContainer newItem, BaseContainer oldItem) |
| void | OnExport (BaseContainer item) |
| void | OnSelectionChanged () |
| bool | IsReadOnly (BaseContainer item, bool isImporting) |
| string | GetExportColumn (BaseContainer item, string languageCode) |
| Called for each item during building runtime table, expected column name to export for given language. | |
Public Member Functions inherited from WorkbenchPlugin | |
| void | RunCommandline () |
| void | OnResourceContextMenu (notnull array< ResourceName > resources) |
Public Member Functions inherited from Managed | |
| proto external ref Managed | Clone () |
| Return shallow copy of object, or null if it is not allowed (not public constructor) | |
Static Public Member Functions | |
| static string | SanitizeToken (string token) |
| Sanitise the provided token to prevent a potential headers exploit. | |
Protected Member Functions | |
| override void | Run () |
| bool | CheckFields (notnull BaseContainer item) |
| Check if Id, Default Source and eventually Default Source Edited config fields are correct. | |
| bool | StartProcess (notnull map< string, ref TranslationPlugin_DataWrapper > idWrapperMap) |
| Send REST request or Simulate. | |
| bool | SendRequest (notnull RestApi restAPI, notnull TranslationPluginRequest request) |
| void | REST_OnSuccess (RestCallback cb=null) |
| Method called by m_RestCallback's OnSuccess calls ProcessSuccessResponse quickly, kept short for simulation purpose. | |
| void | ProcessSuccessResponse (notnull TranslationPluginResponse response) |
| Processes successful response, whether real or simulated. | |
| void | REST_OnError (RestCallback cb=null) |
| Method called by m_RestCallback's OnError - calls ProcessErrorResponse quickly, kept short for simulation purpose. | |
| void | ProcessErrorResponse (HttpCode errorCode, ERestResult restResult) |
| Processes error response, whether real or simulated. | |
| map< string, ref TranslationPlugin_DataWrapper > | GetIdWrapperMap (notnull BaseContainerList stringTableItems, notnull array< int > rowsToTranslate) |
| Get required translations from selected/filtered rows. | |
| TranslationPlugin_DataWrapper | CreateDataWrapper (string id, notnull BaseContainer item) |
| map< string, string > | GetAllItemTranslations (notnull BaseContainer item) |
| int | ApplyTranslations (notnull LocalizationEditor stringEditor, notnull TranslationPluginResponse response) |
| Apply translations to the stringtable. | |
| void | ResetRequestState () |
| Reset variables to brand new. | |
| TranslationPluginResponse | GetFakeResponse () |
| Get a fake response based on requested ids and locales. | |
| void | ResetConfig () |
| Set a config with the attributes's default values. | |
| bool | LoadConfig (ResourceName resourceName) |
| override void | Configure () |
| bool | ConfigureClose () |
| bool | ConfigureValidate () |
| bool | ConfigureLoadConfig () |
| int | ButtonLoadConfig () |
| int | ButtonValidateClose () |
| int | ButtonClose () |
Static Protected Member Functions | |
| static string | GetTranslationFromLocale (string locale, notnull TranslationPluginResultHolder holder) |
| Get the holder's translation corresponding to the locale. | |
| static bool | SplitURL (string url, out string protocol, out string address, out string query) |
| static bool | AreLocalesEqual (notnull array< string > localesA, notnull array< string > localesB) |
| static void | PrintDialog (string message, string caption, LogLevel level) |
| Print and show a Workbench dialog. | |
| static void | PrintFormatDialog (string message, string param1, string param2="", string param3="", string caption="", LogLevel level=LogLevel.WARNING) |
| Print and show a Workbench dialog. | |
| static string | FormatDurationMs (int milliSeconds) |
| Format provided milliseconds into user-friendly time. | |
Protected Attributes | |
| bool | m_bDisableLocalesGrouping |
| ETranslationPlugin_EditedRowsMode | m_eEditedEntriesMode |
| bool | m_bOverwriteExistingTranslations |
| bool | m_bSetEditedAsOriginal |
| string | m_sServerURL |
| string | m_sServerToken |
| bool | m_bDisplayAdvancedStatsOnSuccess |
| ref TranslationPluginMatchConfig | m_MatchConfig |
| bool | m_bLogChanges |
| bool | m_bLogNetwork |
| ETranslationPlugin_ProcessMode | m_eProcessMode |
| ref map< string, ref TranslationPlugin_DataWrapper > | m_mIdDataMap |
| int | m_iTranslationQueriesCount |
| ref array< string > | m_aGlobalLocales |
| bool | m_bWaitingOnRestAPI |
| int | m_iLastUsage |
| ref RestCallback | m_RestCallback |
| ref WBProgressDialog | m_ProgressBar |
Static Protected Attributes | |
| static const string | PLUGIN_NAME = "Translation plugin" |
| static const string | SOURCE_ID = "SOURCE" |
| static const string | SOURCE_EDITED_ID = "SOURCE_EDITED" |
| static const int | MAX_DISPLAYED_IDS = 6 |
| max item ids displayed in the "are you sure?" modal | |
| static const int | GENDER_MALE_INDEX = 1 |
| static const int | GENDER_FEMALE_INDEX = 2 |
| static const int | GENDER_OTHER_INDEX = 3 |
| static const string | GENDER_MALE_VALUE = "M" |
| static const string | GENDER_FEMALE_VALUE = "F" |
| static const string | GENDER_OTHER_VALUE = "O" |
| static const string | PROTOCOL_SEPARATOR = ":/" + "/" |
| static const string | DEFAULT_PROTOCOL = "https" |
| static const ref array< string > | ACCEPTED_PROTOCOLS = { "http" + PROTOCOL_SEPARATOR, DEFAULT_PROTOCOL + PROTOCOL_SEPARATOR } |
| static const string | TOKEN_WHITELIST = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~+/=" |
This plugin contacts an API through JSON to obtain translations from selected rows.
|
protected |
Apply translations to the stringtable.
| [in] | stringEditor | required to set the edits |
| [in] | response | the server's response |
|
staticprotected |
| [in] | localesA | |
| [in] | localesB |
|
protected |
|
protected |
|
protected |
|
protected |
Check if Id, Default Source and eventually Default Source Edited config fields are correct.
| [in] | item |
|
protected |
Implements WorkbenchPlugin.
|
protected |
|
protected |
|
protected |
|
protected |
| [in] | id | |
| [in] | item |
Format provided milliseconds into user-friendly time.
| [in] | milliSeconds | the absolute value is taken |
|
protected |
| [in] | item |
|
protected |
Get a fake response based on requested ids and locales.
|
protected |
Get required translations from selected/filtered rows.
| [in] | stringTableItems | |
| [in] | rowsToTranslate |
|
staticprotected |
Get the holder's translation corresponding to the locale.
| [in] | locale | e.g fr_fr |
| [in] | holder | the translation holder to parse |
|
protected |
| [in] | resourceName | the config to load |
| override void TranslationPlugin.OnStringTableItemContextMenu | ( | ) |
Implements LocalizationEditorPlugin.
|
staticprotected |
Print and show a Workbench dialog.
| [in] | message | |
| [in] | caption | |
| [in] | level |
|
staticprotected |
Print and show a Workbench dialog.
| [in] | message | |
| [in] | param1 | |
| [in] | param2 | |
| [in] | param3 | |
| [in] | caption | |
| [in] | level |
|
protected |
Processes error response, whether real or simulated.
| [in] | errorCode | |
| [in] | restResult |
|
protected |
Processes successful response, whether real or simulated.
| [in] | response |
|
protected |
Set a config with the attributes's default values.
|
protected |
Reset variables to brand new.
|
protected |
Method called by m_RestCallback's OnError - calls ProcessErrorResponse quickly, kept short for simulation purpose.
| [in] | cb |
|
protected |
Method called by m_RestCallback's OnSuccess calls ProcessSuccessResponse quickly, kept short for simulation purpose.
| [in] | cb |
|
protected |
Implements WorkbenchPlugin.
Sanitise the provided token to prevent a potential headers exploit.
| [in] | token | the token to sanitise |
|
protected |
|
staticprotected |
| [in] | url | in format http(s)://anything(/)(?xyz), e.g:
|
| [out] | protocol | http:// or https:// |
| [out] | address | the API's address e.g https://localhost/path/to/api, NOT server root address |
| [out] | query | what comes after the question mark in the URL (e.g mode=translate&version=1.5, without question mark) |
|
protected |
Send REST request or Simulate.
| [in] | idWrapperMap | map with required translations |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
max item ids displayed in the "are you sure?" modal
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |