mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-01 13:32:16 +02:00
update
* update initial WIP
This commit is contained in:
parent
fe2f10138a
commit
7f92f2b942
28
contrib/translations/DE.json
Normal file
28
contrib/translations/DE.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"language": "DE",
|
||||
"list": [
|
||||
{
|
||||
"1": "Keine Benutzer- oder Systemkonfigurationsdatei gefunden, die Anwendungsstandardwerte verwendet",
|
||||
"2": "Systemkonfigurationsdatei erfolgreich geladen",
|
||||
"3": "Die Systemkonfigurationsdatei weist Fehler auf. Bitte überprüfen Sie Ihre Konfiguration",
|
||||
"4": "Konfigurationsdatei erfolgreich geladen",
|
||||
"5": "Konfigurationsdatei hat Fehler - bitte überprüfen Sie Ihre Konfiguration",
|
||||
"6": "Verwenden der Konfigurationsoption für globale Azure AD-Endpunkte",
|
||||
"7": "Verwenden der Konfigurationsoption für Azure AD für Endpunkte der US-Regierung",
|
||||
"8": "Verwenden der Konfigurationsoption für Azure AD für US Government Endpoints (DOD)",
|
||||
"9": "Verwenden der Konfigurationsoption für Azure AD Germany",
|
||||
"10": "Verwenden der Konfigurationsoption für Azure AD China, das von 21Vianet betrieben wird",
|
||||
"11": "Unbekannter Azure AD-Endpunkt – mit globalen Azure AD-Endpunkten",
|
||||
"12": "Unbekannter Schlüssel in der Konfigurationsdatei: ",
|
||||
"13": "Fehlerhafte Konfigurationszeile: ",
|
||||
"14": "Die Konfigurationsdatei wurde aktualisiert und überprüft, ob --resync erforderlich ist",
|
||||
"15": "Eine Änderung der Anwendungskonfiguration wurde festgestellt, wenn eine --resync erforderlich ist",
|
||||
"16": "DRY-RUN Konfiguriert. Die folgende Ausgabe zeigt, was passiert wäre",
|
||||
"17": "Verwenden des Protokolldateiverzeichnisses: ",
|
||||
"18": "Datenbankschema geändert, Resync erforderlich",
|
||||
"19": "Gespeicherten Status löschen ...",
|
||||
"20": "FEHLER: Microsoft OneDrive-API-Dienst kann nicht erreicht werden, Anwendung kann nicht initialisiert werden"
|
||||
|
||||
},
|
||||
]
|
||||
}
|
|
@ -1,117 +1,28 @@
|
|||
{
|
||||
"language": "EN-US",
|
||||
"list": [
|
||||
"No user or system config file found, using application defaults",
|
||||
"System configuration file successfully loaded",
|
||||
"System configuration file has errors - please check your configuration",
|
||||
"Configuration file successfully loaded",
|
||||
"Configuration file has errors - please check your configuration",
|
||||
"Using config option for Global Azure AD Endpoints",
|
||||
"Using config option for Azure AD for US Government Endpoints",
|
||||
"Using config option for Azure AD for US Government Endpoints (DOD)",
|
||||
"Using config option for Azure AD Germany",
|
||||
"Using config option for Azure AD China operated by 21Vianet",
|
||||
"Unknown Azure AD Endpoint - using Global Azure AD Endpoints",
|
||||
"Unknown key in config file: ",
|
||||
"Malformed config line: ",
|
||||
"config file has been updated, checking if --resync needed",
|
||||
"An application configuration change has been detected where a --resync is required",
|
||||
"DRY-RUN Configured. Output below shows what 'would' have occurred",
|
||||
"Using logfile dir: ",
|
||||
"Database schema changed, resync needed",
|
||||
"Deleting the saved status ...",
|
||||
"ERROR: Unable to reach Microsoft OneDrive API service, unable to initialize application",
|
||||
"ERROR: Unable to reach Microsoft OneDrive API service at this point in time, re-trying network tests",
|
||||
"Internet connectivity to Microsoft OneDrive service has been restored",
|
||||
"ERROR: The OneDrive Linux Client was unable to reconnect to the Microsoft OneDrive service after 10000 attempts lasting over 1.2 years!",
|
||||
"Initializing the OneDrive API ...",
|
||||
"Could not initialize the OneDrive API",
|
||||
"Application has been successfully authorized, however no additional command switches were provided",
|
||||
"Please use 'onedrive --help' for further assistance in regards to running this application",
|
||||
"Application has not been successfully authorized. Please check your URI response entry and try again",
|
||||
"ERROR: --synchronize or --monitor switches missing from your command line input. Please add one (not both) of these switches to your command line",
|
||||
"No OneDrive sync will be performed without one of these two arguments being present",
|
||||
"ERROR: --synchronize and --monitor cannot be used together",
|
||||
"Opening the item database ...",
|
||||
"ERROR: Invalid 'User|Group|Other' permissions set within config file. Please check your config file.",
|
||||
"All operations will be performed in: ",
|
||||
"ERROR: Unable to create local OneDrive syncDir - ",
|
||||
"ERROR: Invalid skip_file entry '.*' detected",
|
||||
"Initializing the Synchronization Engine ...",
|
||||
"Cannot connect to Microsoft OneDrive Service - Network Connection Issue",
|
||||
"WARNING: Application has been configured to bypass local data preservation in the event of file conflict",
|
||||
"WARNING: Local data loss MAY occur in this scenario",
|
||||
"ERROR: .nosync file found. Aborting synchronization process to safeguard data",
|
||||
"ERROR: Unsupported account type for listing OneDrive Business Shared Folders",
|
||||
"ERROR: Unsupported account type for syncing OneDrive Business Shared Folders",
|
||||
"WARNING: The requested path for --single-directory does not exist locally. Creating requested path within: ",
|
||||
"Initializing monitor ...",
|
||||
"OneDrive monitor interval (seconds): ",
|
||||
"[M] Skipping watching path - .folder found & --skip-dot-files enabled: ",
|
||||
"[M] Directory created: ",
|
||||
"Offline, cannot create remote directory!",
|
||||
"Cannot create remote directory: ",
|
||||
"[M] File changed: ",
|
||||
"Offline, cannot upload changed item!",
|
||||
"Cannot upload file changes/creation: ",
|
||||
"[M] Item deleted: ",
|
||||
"Offline, cannot delete item!",
|
||||
"Item cannot be deleted from OneDrive because it was not found in the local database",
|
||||
"Cannot delete remote item: ",
|
||||
"[M] Item moved: ",
|
||||
"Offline, cannot move item!",
|
||||
"Cannot move item: ",
|
||||
"ERROR: ",
|
||||
"ERROR: The following inotify error was generated: ",
|
||||
"Starting a sync with OneDrive",
|
||||
"Sync with OneDrive is complete",
|
||||
"Persistent connection errors, reinitializing connection",
|
||||
"Authorization token invalid, use --logout to authorize the client again",
|
||||
"Syncing changes from this selected path: ",
|
||||
"Syncing changes from selected local path only - NOT syncing data changes from OneDrive ...",
|
||||
"Syncing changes from selected local path first before downloading changes from OneDrive ...",
|
||||
"Syncing changes from selected OneDrive path ...",
|
||||
"Syncing changes from local path only - NOT syncing data changes from OneDrive ...",
|
||||
"Syncing changes from local path first before downloading changes from OneDrive ...",
|
||||
"Syncing changes from OneDrive ...",
|
||||
"Giving up on sync after three attempts: ",
|
||||
"Retry sync count: ",
|
||||
" Got termination signal, shutting down DB connection",
|
||||
"Syncing changes from OneDrive only - NOT syncing local data changes to OneDrive ...",
|
||||
"The file does not have any hash",
|
||||
"ERROR: Check your 'drive_id' entry in your configuration file as it may be incorrect",
|
||||
"ERROR: Check your configuration as your refresh_token may be empty or invalid. You may need to issue a --logout and re-authorize this client.",
|
||||
"ERROR: OneDrive account currently has zero space available. Please free up some space online.",
|
||||
"WARNING: OneDrive quota information is being restricted or providing a zero value. Please fix by speaking to your OneDrive / Office 365 Administrator.",
|
||||
"ERROR: OneDrive quota information is missing. Potentially your OneDrive account currently has zero space available. Please free up some space online.",
|
||||
"ERROR: OneDrive quota information is being restricted. Please fix by speaking to your OneDrive / Office 365 Administrator.",
|
||||
"Application version: ",
|
||||
"Account Type: ",
|
||||
"Default Drive ID: ",
|
||||
"Default Root ID: ",
|
||||
"Remaining Free Space: ",
|
||||
"Continuing the upload session ...",
|
||||
"Removing local file as --upload-only & --remove-source-files configured",
|
||||
"ERROR: File failed to upload. Increase logging verbosity to determine why.",
|
||||
"Skipping item - excluded by skip_dir config: ",
|
||||
"Syncing this OneDrive Personal Shared Folder: ",
|
||||
"Attempting to sync OneDrive Business Shared Folders",
|
||||
"Syncing this OneDrive Business Shared Folder: ",
|
||||
"OneDrive Business Shared Folder - Shared By: ",
|
||||
"WARNING: Skipping shared folder due to existing name conflict: ",
|
||||
"WARNING: Skipping changes of Path ID: ",
|
||||
"WARNING: To sync this shared folder, this shared folder needs to be renamed",
|
||||
"WARNING: Conflict Shared By: ",
|
||||
"WARNING: Not syncing this OneDrive Business Shared File: ",
|
||||
"OneDrive Business Shared File - Shared By: ",
|
||||
"WARNING: Not syncing this OneDrive Business Shared item: ",
|
||||
"ERROR: onedrive.getSharedWithMe call returned an invalid JSON Object",
|
||||
"Getting path details from OneDrive ...",
|
||||
"ERROR: The requested single directory to sync was not found on OneDrive",
|
||||
"Fetching details for OneDrive Root",
|
||||
"OneDrive Root does not exist in the database. We need to add it.",
|
||||
"Added OneDrive Root to the local database",
|
||||
"OneDrive Root exists in the database",
|
||||
"ERROR: Unable to query OneDrive for account details",
|
||||
{
|
||||
"1": "No user or system config file found, using application defaults",
|
||||
"2": "System configuration file successfully loaded",
|
||||
"3": "System configuration file has errors - please check your configuration",
|
||||
"4": "Configuration file successfully loaded",
|
||||
"5": "Configuration file has errors - please check your configuration",
|
||||
"6": "Using config option for Global Azure AD Endpoints",
|
||||
"7": "Using config option for Azure AD for US Government Endpoints",
|
||||
"8": "Using config option for Azure AD for US Government Endpoints (DOD)",
|
||||
"9": "Using config option for Azure AD Germany",
|
||||
"10": "Using config option for Azure AD China operated by 21Vianet",
|
||||
"11": "Unknown Azure AD Endpoint - using Global Azure AD Endpoints",
|
||||
"12": "Unknown key in config file: ",
|
||||
"13": "Malformed config line: ",
|
||||
"14": "config file has been updated, checking if --resync needed",
|
||||
"15": "An application configuration change has been detected where a --resync is required",
|
||||
"16": "DRY-RUN Configured. Output below shows what 'would' have occurred",
|
||||
"17": "Using logfile dir: ",
|
||||
"18": "Database schema changed, resync needed",
|
||||
"19": "Deleting the saved status ...",
|
||||
"20": "ERROR: Unable to reach Microsoft OneDrive API service, unable to initialize application"
|
||||
|
||||
},
|
||||
]
|
||||
}
|
|
@ -3,18 +3,19 @@
|
|||
// - log.vlog
|
||||
// - log.error
|
||||
// - log.logAndNotify
|
||||
import std.string, std.stdio, std.json, std.file;
|
||||
import std.string, std.stdio, std.json, std.file, std.conv;
|
||||
static import log;
|
||||
|
||||
ulong defaultMessageCount = 0;
|
||||
string[] languageResponsesEN_AU;
|
||||
string[] languageResponsesEN_US;
|
||||
string defaultBadLookupResponse = "ERROR: BAD LOOKUP INDEX ";
|
||||
string[] languageResponsesDefault;
|
||||
string[] languageResponsesTranslations;
|
||||
string defaultBadLookupResponse = "ERROR: BAD LOOKUP INDEX FOR LANGUAGE TRANSLATION";
|
||||
|
||||
// Initialise default message lookup using EN-AU
|
||||
void initialize() {
|
||||
// Initialise default messages
|
||||
initialise_EN_AU();
|
||||
defaultMessageCount = count(languageResponsesEN_AU);
|
||||
defaultMessageCount = count(languageResponsesDefault);
|
||||
}
|
||||
|
||||
// Load user configured translation files from a file
|
||||
|
@ -24,7 +25,9 @@ void initializeUserConfiguredLanguageTranslations(string languageIdentifier) {
|
|||
|
||||
// Translation files
|
||||
string EN_US_TranslationFile = translationPath ~ "EN-US.json";
|
||||
string DE_TranslationFile = translationPath ~ "DE.json";
|
||||
|
||||
// Load the right file
|
||||
switch (languageIdentifier) {
|
||||
case "EN-US":
|
||||
// Load Translation Files if they exist
|
||||
|
@ -32,20 +35,19 @@ void initializeUserConfiguredLanguageTranslations(string languageIdentifier) {
|
|||
// Load the file
|
||||
auto fileContents = readText(EN_US_TranslationFile);
|
||||
JSONValue languageList = parseJSON(fileContents);
|
||||
|
||||
// Load the message into the required array
|
||||
foreach (translationItem; languageList["list"].array) {
|
||||
string responseString = translationItem.toString;
|
||||
responseString = responseString[1 .. $-1];
|
||||
languageResponsesEN_US ~= responseString;
|
||||
}
|
||||
// If the loaded responses != defaultMessageCount there will be an issue in translation .. warn
|
||||
writeln("WARNING: " ~ EN_US_TranslationFile ~ " is out of sync with default application messages - application output will be inaccurate");
|
||||
languageResponsesTranslations = loadTranslationFromJSON(EN_US_TranslationFile, languageList, languageIdentifier);
|
||||
}
|
||||
break;
|
||||
|
||||
case "DE":
|
||||
//logMessageResponse = getResponseFromIndex_EN_US(requiredResponseIndex);
|
||||
// Load Translation Files if they exist
|
||||
if (exists(DE_TranslationFile)) {
|
||||
// Load the file
|
||||
auto fileContents = readText(DE_TranslationFile);
|
||||
JSONValue languageList = parseJSON(fileContents);
|
||||
// Load the message into the required array
|
||||
languageResponsesTranslations = loadTranslationFromJSON(DE_TranslationFile, languageList, languageIdentifier);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
//logMessageResponse = getResponseFromIndex_EN_AU(requiredResponseIndex);
|
||||
|
@ -62,15 +64,12 @@ string provideLanguageTranslation(string languageIdentifier, int requiredRespons
|
|||
|
||||
switch (languageIdentifier) {
|
||||
case "EN-AU":
|
||||
// Language Maintainer: abraunegg
|
||||
// Use EN-AU for application output
|
||||
logMessageResponse = getResponseFromIndex_EN_AU(requiredResponseIndex);
|
||||
break;
|
||||
case "EN-US":
|
||||
// Language Maintainer: abraunegg
|
||||
logMessageResponse = getResponseFromIndex_EN_US(requiredResponseIndex);
|
||||
break;
|
||||
default:
|
||||
logMessageResponse = getResponseFromIndex_EN_AU(requiredResponseIndex);
|
||||
// Default is to use any 'loaded' translations
|
||||
logMessageResponse = getResponseFromIndex(requiredResponseIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -78,131 +77,41 @@ string provideLanguageTranslation(string languageIdentifier, int requiredRespons
|
|||
return logMessageResponse;
|
||||
}
|
||||
|
||||
// Load EN-AU application messages
|
||||
void initialise_EN_AU(){
|
||||
// The below JSON array contains all the default application messages
|
||||
JSONValue languageList = [ "language": "EN-AU"];
|
||||
languageList.object["list"] = JSONValue([
|
||||
"No user or system config file found, using application defaults",
|
||||
"System configuration file successfully loaded",
|
||||
"System configuration file has errors - please check your configuration",
|
||||
"Configuration file successfully loaded",
|
||||
"Configuration file has errors - please check your configuration",
|
||||
"Using config option for Global Azure AD Endpoints",
|
||||
"Using config option for Azure AD for US Government Endpoints",
|
||||
"Using config option for Azure AD for US Government Endpoints (DOD)",
|
||||
"Using config option for Azure AD Germany",
|
||||
"Using config option for Azure AD China operated by 21Vianet",
|
||||
"Unknown Azure AD Endpoint - using Global Azure AD Endpoints",
|
||||
"Unknown key in config file: ",
|
||||
"Malformed config line: ",
|
||||
"config file has been updated, checking if --resync needed",
|
||||
"An application configuration change has been detected where a --resync is required",
|
||||
"DRY-RUN Configured. Output below shows what 'would' have occurred",
|
||||
"Using logfile dir: ",
|
||||
"Database schema changed, resync needed",
|
||||
"Deleting the saved status ...",
|
||||
"ERROR: Unable to reach Microsoft OneDrive API service, unable to initialise application",
|
||||
"ERROR: Unable to reach Microsoft OneDrive API service at this point in time, re-trying network tests",
|
||||
"Internet connectivity to Microsoft OneDrive service has been restored",
|
||||
"ERROR: The OneDrive Linux Client was unable to reconnect to the Microsoft OneDrive service after 10000 attempts lasting over 1.2 years!",
|
||||
"Initialising the OneDrive API ...",
|
||||
"Could not initialise the OneDrive API",
|
||||
"Application has been successfully authorised, however no additional command switches were provided",
|
||||
"Please use 'onedrive --help' for further assistance in regards to running this application",
|
||||
"Application has not been successfully authorised. Please check your URI response entry and try again",
|
||||
"ERROR: --synchronize or --monitor switches missing from your command line input. Please add one (not both) of these switches to your command line",
|
||||
"No OneDrive sync will be performed without one of these two arguments being present",
|
||||
"ERROR: --synchronize and --monitor cannot be used together",
|
||||
"Opening the item database ...",
|
||||
"ERROR: Invalid 'User|Group|Other' permissions set within config file. Please check your config file.",
|
||||
"All operations will be performed in: ",
|
||||
"ERROR: Unable to create local OneDrive syncDir - ",
|
||||
"ERROR: Invalid skip_file entry '.*' detected",
|
||||
"Initialising the Synchronisation Engine ...",
|
||||
"Cannot connect to Microsoft OneDrive Service - Network Connection Issue",
|
||||
"WARNING: Application has been configured to bypass local data preservation in the event of file conflict",
|
||||
"WARNING: Local data loss MAY occur in this scenario",
|
||||
"ERROR: .nosync file found. Aborting synchronisation process to safeguard data",
|
||||
"ERROR: Unsupported account type for listing OneDrive Business Shared Folders",
|
||||
"ERROR: Unsupported account type for syncing OneDrive Business Shared Folders",
|
||||
"WARNING: The requested path for --single-directory does not exist locally. Creating requested path within: ",
|
||||
"Initialising monitor ...",
|
||||
"OneDrive monitor interval (seconds): ",
|
||||
"[M] Skipping watching path - .folder found & --skip-dot-files enabled: ",
|
||||
"[M] Directory created: ",
|
||||
"Offline, cannot create remote directory!",
|
||||
"Cannot create remote directory: ",
|
||||
"[M] File changed: ",
|
||||
"Offline, cannot upload changed item!",
|
||||
"Cannot upload file changes/creation: ",
|
||||
"[M] Item deleted: ",
|
||||
"Offline, cannot delete item!",
|
||||
"Item cannot be deleted from OneDrive because it was not found in the local database",
|
||||
"Cannot delete remote item: ",
|
||||
"[M] Item moved: ",
|
||||
"Offline, cannot move item!",
|
||||
"Cannot move item: ",
|
||||
"ERROR: ",
|
||||
"ERROR: The following inotify error was generated: ",
|
||||
"Starting a sync with OneDrive",
|
||||
"Sync with OneDrive is complete",
|
||||
"Persistent connection errors, reinitialising connection",
|
||||
"Authorisation token invalid, use --logout to authorise the client again",
|
||||
"Syncing changes from this selected path: ",
|
||||
"Syncing changes from selected local path only - NOT syncing data changes from OneDrive ...",
|
||||
"Syncing changes from selected local path first before downloading changes from OneDrive ...",
|
||||
"Syncing changes from selected OneDrive path ...",
|
||||
"Syncing changes from local path only - NOT syncing data changes from OneDrive ...",
|
||||
"Syncing changes from local path first before downloading changes from OneDrive ...",
|
||||
"Syncing changes from OneDrive ...",
|
||||
"Giving up on sync after three attempts: ",
|
||||
"Retry sync count: ",
|
||||
" Got termination signal, shutting down DB connection",
|
||||
"Syncing changes from OneDrive only - NOT syncing local data changes to OneDrive ...",
|
||||
"The file does not have any hash",
|
||||
"ERROR: Check your 'drive_id' entry in your configuration file as it may be incorrect",
|
||||
"ERROR: Check your configuration as your refresh_token may be empty or invalid. You may need to issue a --logout and re-authorise this client.",
|
||||
"ERROR: OneDrive account currently has zero space available. Please free up some space online.",
|
||||
"WARNING: OneDrive quota information is being restricted or providing a zero value. Please fix by speaking to your OneDrive / Office 365 Administrator.",
|
||||
"ERROR: OneDrive quota information is missing. Potentially your OneDrive account currently has zero space available. Please free up some space online.",
|
||||
"ERROR: OneDrive quota information is being restricted. Please fix by speaking to your OneDrive / Office 365 Administrator.",
|
||||
"Application version: ",
|
||||
"Account Type: ",
|
||||
"Default Drive ID: ",
|
||||
"Default Root ID: ",
|
||||
"Remaining Free Space: ",
|
||||
"Continuing the upload session ...",
|
||||
"Removing local file as --upload-only & --remove-source-files configured",
|
||||
"ERROR: File failed to upload. Increase logging verbosity to determine why.",
|
||||
"Skipping item - excluded by skip_dir config: ",
|
||||
"Syncing this OneDrive Personal Shared Folder: ",
|
||||
"Attempting to sync OneDrive Business Shared Folders",
|
||||
"Syncing this OneDrive Business Shared Folder: ",
|
||||
"OneDrive Business Shared Folder - Shared By: ",
|
||||
"WARNING: Skipping shared folder due to existing name conflict: ",
|
||||
"WARNING: Skipping changes of Path ID: ",
|
||||
"WARNING: To sync this shared folder, this shared folder needs to be renamed",
|
||||
"WARNING: Conflict Shared By: ",
|
||||
"WARNING: Not syncing this OneDrive Business Shared File: ",
|
||||
"OneDrive Business Shared File - Shared By: ",
|
||||
"WARNING: Not syncing this OneDrive Business Shared item: ",
|
||||
"ERROR: onedrive.getSharedWithMe call returned an invalid JSON Object",
|
||||
"Getting path details from OneDrive ...",
|
||||
"ERROR: The requested single directory to sync was not found on OneDrive",
|
||||
"Fetching details for OneDrive Root",
|
||||
"OneDrive Root does not exist in the database. We need to add it.",
|
||||
"Added OneDrive Root to the local database",
|
||||
"OneDrive Root exists in the database",
|
||||
"ERROR: Unable to query OneDrive for account details",
|
||||
]);
|
||||
// Load specific application messages
|
||||
string[] loadTranslationFromJSON(string translationFile, JSONValue languageList, string languageIdentifier) {
|
||||
// parse the input JSON and provide back the loaded array for use
|
||||
string[] languageResponsesTemp;
|
||||
|
||||
// Load the message into the array
|
||||
// Load the message into the required array
|
||||
foreach (translationItem; languageList["list"].array) {
|
||||
string responseString = translationItem.toString;
|
||||
responseString = responseString[1 .. $-1];
|
||||
languageResponsesEN_AU ~= responseString;
|
||||
// translationItem["2"].str
|
||||
ulong thisMessageID = 0;
|
||||
log.vdebug("Loading Language Translations for " ~ languageIdentifier);
|
||||
while (thisMessageID != defaultMessageCount) {
|
||||
// iterate through message ID's
|
||||
thisMessageID++;
|
||||
// If the translation JSON has an unequal number of entries to default, the 'key' will not be found
|
||||
try {
|
||||
// debug output what we are loading and at what index
|
||||
log.vdebug("translationItem['" ~ to!string(thisMessageID) ~ "']: ", translationItem[to!string(thisMessageID)].str);
|
||||
string responseString = translationItem[to!string(thisMessageID)].str;
|
||||
languageResponsesTemp ~= responseString;
|
||||
} catch (std.json.JSONException) {
|
||||
// dont print anything out - catch error and move on
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the loaded responses != defaultMessageCount there will be an issue in translation .. warn the user
|
||||
if (count(languageResponsesTemp) < defaultMessageCount) {
|
||||
log.log("WARNING: " ~ translationFile ~ " is out of sync with default application messages - application output will be inaccurate");
|
||||
ulong missing = 0;
|
||||
missing = defaultMessageCount - count(languageResponsesTemp);
|
||||
log.vdebug("Number of missing translations: ", missing);
|
||||
}
|
||||
|
||||
// Return the loaded translations
|
||||
return languageResponsesTemp;
|
||||
}
|
||||
|
||||
// Provide the application message based on the index as provided
|
||||
|
@ -211,7 +120,7 @@ string getResponseFromIndex_EN_AU(int requiredResponseIndex) {
|
|||
// get response from message array
|
||||
try {
|
||||
// try and get the message from the required index
|
||||
requiredResponse = languageResponsesEN_AU[requiredResponseIndex];
|
||||
requiredResponse = languageResponsesDefault[requiredResponseIndex];
|
||||
} catch (core.exception.RangeError e) {
|
||||
// invalid index provided
|
||||
requiredResponse = defaultBadLookupResponse;
|
||||
|
@ -221,16 +130,213 @@ string getResponseFromIndex_EN_AU(int requiredResponseIndex) {
|
|||
}
|
||||
|
||||
// Provide the application message based on the index as provided
|
||||
string getResponseFromIndex_EN_US(int requiredResponseIndex) {
|
||||
string getResponseFromIndex(int requiredResponseIndex) {
|
||||
string requiredResponse;
|
||||
// get response from message array
|
||||
try {
|
||||
// try and get the message from the required index
|
||||
requiredResponse = languageResponsesEN_US[requiredResponseIndex];
|
||||
requiredResponse = languageResponsesTranslations[requiredResponseIndex];
|
||||
} catch (core.exception.RangeError e) {
|
||||
// invalid index provided
|
||||
requiredResponse = defaultBadLookupResponse;
|
||||
// invalid index was provided
|
||||
// get the required response from EN-AU ... whilst might not be ideal (potentially different language) better than a generic error response
|
||||
requiredResponse = getResponseFromIndex_EN_AU(requiredResponseIndex);
|
||||
}
|
||||
// Return language response
|
||||
return requiredResponse;
|
||||
}
|
||||
}
|
||||
|
||||
// Load EN-AU application messages
|
||||
void initialise_EN_AU(){
|
||||
// The below JSON array contains all the default application messages
|
||||
JSONValue languageList = [ "language": "EN-AU"];
|
||||
languageList.object["list"] = JSONValue([
|
||||
JSONValue([ "1": "No user or system config file found, using application defaults" ]),
|
||||
JSONValue([ "2": "System configuration file successfully loaded" ]),
|
||||
JSONValue([ "3": "System configuration file has errors - please check your configuration" ]),
|
||||
JSONValue([ "4": "Configuration file successfully loaded" ]),
|
||||
JSONValue([ "5": "Configuration file has errors - please check your configuration" ]),
|
||||
JSONValue([ "6": "Using config option for Global Azure AD Endpoints" ]),
|
||||
JSONValue([ "7": "Using config option for Azure AD for US Government Endpoints" ]),
|
||||
JSONValue([ "8": "Using config option for Azure AD for US Government Endpoints (DOD)" ]),
|
||||
JSONValue([ "9": "Using config option for Azure AD Germany" ]),
|
||||
JSONValue([ "10": "Using config option for Azure AD China operated by 21Vianet" ]),
|
||||
JSONValue([ "11": "Unknown Azure AD Endpoint - using Global Azure AD Endpoints" ]),
|
||||
JSONValue([ "12": "Unknown key in config file: " ]),
|
||||
JSONValue([ "13": "Malformed config line: " ]),
|
||||
JSONValue([ "14": "config file has been updated, checking if --resync needed" ]),
|
||||
JSONValue([ "15": "An application configuration change has been detected where a --resync is required" ]),
|
||||
JSONValue([ "16": "DRY-RUN Configured. Output below shows what 'would' have occurred" ]),
|
||||
JSONValue([ "17": "Using logfile dir: " ]),
|
||||
JSONValue([ "18": "Database schema changed, resync needed" ]),
|
||||
JSONValue([ "19": "Deleting the saved status ..." ]),
|
||||
JSONValue([ "20": "ERROR: Unable to reach Microsoft OneDrive API service, unable to initialise application" ]),
|
||||
JSONValue([ "21": "ERROR: Unable to reach Microsoft OneDrive API service at this point in time, re-trying network tests" ]),
|
||||
JSONValue([ "22": "Internet connectivity to Microsoft OneDrive service has been restored" ]),
|
||||
JSONValue([ "23": "ERROR: The OneDrive Linux Client was unable to reconnect to the Microsoft OneDrive service after 10000 attempts lasting over 1.2 years!" ]),
|
||||
JSONValue([ "24": "Initialising the OneDrive API ..." ]),
|
||||
JSONValue([ "25": "Could not initialise the OneDrive API" ]),
|
||||
JSONValue([ "26": "Application has been successfully authorised, however no additional command switches were provided" ]),
|
||||
JSONValue([ "27": "Please use 'onedrive --help' for further assistance in regards to running this application" ]),
|
||||
JSONValue([ "28": "Application has not been successfully authorised. Please check your URI response entry and try again" ]),
|
||||
JSONValue([ "29": "ERROR: --synchronize or --monitor switches missing from your command line input. Please add one (not both) of these switches to your command line" ]),
|
||||
JSONValue([ "30": "No OneDrive sync will be performed without one of these two arguments being present" ]),
|
||||
JSONValue([ "31": "ERROR: --synchronize and --monitor cannot be used together" ]),
|
||||
JSONValue([ "32": "Opening the item database ..." ]),
|
||||
JSONValue([ "33": "ERROR: Invalid 'User|Group|Other' permissions set within config file. Please check your config file." ]),
|
||||
JSONValue([ "34": "All operations will be performed in: " ]),
|
||||
JSONValue([ "35": "ERROR: Unable to create local OneDrive syncDir - " ]),
|
||||
JSONValue([ "36": "ERROR: Invalid skip_file entry '.*' detected" ]),
|
||||
JSONValue([ "37": "Initialising the Synchronisation Engine ..." ]),
|
||||
JSONValue([ "38": "Cannot connect to Microsoft OneDrive Service - Network Connection Issue" ]),
|
||||
JSONValue([ "39": "WARNING: Application has been configured to bypass local data preservation in the event of file conflict" ]),
|
||||
JSONValue([ "40": "WARNING: Local data loss MAY occur in this scenario" ]),
|
||||
JSONValue([ "41": "ERROR: .nosync file found. Aborting synchronisation process to safeguard data" ]),
|
||||
JSONValue([ "42": "ERROR: Unsupported account type for listing OneDrive Business Shared Folders" ]),
|
||||
JSONValue([ "43": "ERROR: Unsupported account type for syncing OneDrive Business Shared Folders" ]),
|
||||
JSONValue([ "44": "WARNING: The requested path for --single-directory does not exist locally. Creating requested path within: " ]),
|
||||
JSONValue([ "45": "Initialising monitor ..." ]),
|
||||
JSONValue([ "46": "OneDrive monitor interval (seconds): " ]),
|
||||
JSONValue([ "47": "[M] Skipping watching path - .folder found & --skip-dot-files enabled: " ]),
|
||||
JSONValue([ "48": "[M] Directory created: " ]),
|
||||
JSONValue([ "49": "Offline, cannot create remote directory!" ]),
|
||||
JSONValue([ "50": "Cannot create remote directory: " ]),
|
||||
JSONValue([ "51": "[M] File changed: " ]),
|
||||
JSONValue([ "52": "Offline, cannot upload changed item!" ]),
|
||||
JSONValue([ "53": "Cannot upload file changes/creation: " ]),
|
||||
JSONValue([ "54": "[M] Item deleted: " ]),
|
||||
JSONValue([ "55": "Offline, cannot delete item!" ]),
|
||||
JSONValue([ "56": "Item cannot be deleted from OneDrive because it was not found in the local database" ]),
|
||||
JSONValue([ "57": "Cannot delete remote item: " ]),
|
||||
JSONValue([ "58": "[M] Item moved: " ]),
|
||||
JSONValue([ "59": "Offline, cannot move item!" ]),
|
||||
JSONValue([ "60": "Cannot move item: " ]),
|
||||
JSONValue([ "61": "ERROR: " ]),
|
||||
JSONValue([ "62": "ERROR: The following inotify error was generated: " ]),
|
||||
JSONValue([ "63": "Starting a sync with OneDrive" ]),
|
||||
JSONValue([ "64": "Sync with OneDrive is complete" ]),
|
||||
JSONValue([ "65": "Persistent connection errors, reinitialising connection" ]),
|
||||
JSONValue([ "66": "Authorisation token invalid, use --logout to authorise the client again" ]),
|
||||
JSONValue([ "67": "Syncing changes from this selected path: " ]),
|
||||
JSONValue([ "68": "Syncing changes from selected local path only - NOT syncing data changes from OneDrive ..." ]),
|
||||
JSONValue([ "69": "Syncing changes from selected local path first before downloading changes from OneDrive ..." ]),
|
||||
JSONValue([ "70": "Syncing changes from selected OneDrive path ..." ]),
|
||||
JSONValue([ "71": "Syncing changes from local path only - NOT syncing data changes from OneDrive ..." ]),
|
||||
JSONValue([ "72": "Syncing changes from local path first before downloading changes from OneDrive ..." ]),
|
||||
JSONValue([ "73": "Syncing changes from OneDrive ..." ]),
|
||||
JSONValue([ "74": "Giving up on sync after three attempts: " ]),
|
||||
JSONValue([ "75": "Retry sync count: " ]),
|
||||
JSONValue([ "76": " Got termination signal, shutting down DB connection" ]),
|
||||
JSONValue([ "77": "Syncing changes from OneDrive only - NOT syncing local data changes to OneDrive ..." ]),
|
||||
JSONValue([ "78": "The file does not have any hash" ]),
|
||||
JSONValue([ "79": "ERROR: Check your 'drive_id' entry in your configuration file as it may be incorrect" ]),
|
||||
JSONValue([ "80": "ERROR: Check your configuration as your refresh_token may be empty or invalid. You may need to issue a --logout and re-authorise this client." ]),
|
||||
JSONValue([ "81": "ERROR: OneDrive account currently has zero space available. Please free up some space online." ]),
|
||||
JSONValue([ "82": "WARNING: OneDrive quota information is being restricted or providing a zero value. Please fix by speaking to your OneDrive / Office 365 Administrator." ]),
|
||||
JSONValue([ "83": "ERROR: OneDrive quota information is missing. Potentially your OneDrive account currently has zero space available. Please free up some space online." ]),
|
||||
JSONValue([ "84": "ERROR: OneDrive quota information is being restricted. Please fix by speaking to your OneDrive / Office 365 Administrator." ]),
|
||||
JSONValue([ "85": "Application version: " ]),
|
||||
JSONValue([ "86": "Account Type: " ]),
|
||||
JSONValue([ "87": "Default Drive ID: " ]),
|
||||
JSONValue([ "88": "Default Root ID: " ]),
|
||||
JSONValue([ "89": "Remaining Free Space: " ]),
|
||||
JSONValue([ "90": "Continuing the upload session ..." ]),
|
||||
JSONValue([ "91": "Removing local file as --upload-only & --remove-source-files configured" ]),
|
||||
JSONValue([ "92": "ERROR: File failed to upload. Increase logging verbosity to determine why." ]),
|
||||
JSONValue([ "93": "Skipping item - excluded by skip_dir config: " ]),
|
||||
JSONValue([ "94": "Syncing this OneDrive Personal Shared Folder: " ]),
|
||||
JSONValue([ "95": "Attempting to sync OneDrive Business Shared Folders" ]),
|
||||
JSONValue([ "96": "Syncing this OneDrive Business Shared Folder: " ]),
|
||||
JSONValue([ "97": "OneDrive Business Shared Folder - Shared By: " ]),
|
||||
JSONValue([ "98": "WARNING: Skipping shared folder due to existing name conflict: " ]),
|
||||
JSONValue([ "99": "WARNING: Skipping changes of Path ID: " ]),
|
||||
JSONValue([ "100": "WARNING: To sync this shared folder, this shared folder needs to be renamed" ]),
|
||||
JSONValue([ "101": "WARNING: Conflict Shared By: " ]),
|
||||
JSONValue([ "102": "WARNING: Not syncing this OneDrive Business Shared File: " ]),
|
||||
JSONValue([ "103": "OneDrive Business Shared File - Shared By: " ]),
|
||||
JSONValue([ "104": "WARNING: Not syncing this OneDrive Business Shared item: " ]),
|
||||
JSONValue([ "105": "ERROR: onedrive.getSharedWithMe call returned an invalid JSON Object" ]),
|
||||
JSONValue([ "106": "Getting path details from OneDrive ..." ]),
|
||||
JSONValue([ "107": "ERROR: The requested single directory to sync was not found on OneDrive" ]),
|
||||
JSONValue([ "108": "Fetching details for OneDrive Root" ]),
|
||||
JSONValue([ "109": "OneDrive Root does not exist in the database. We need to add it." ]),
|
||||
JSONValue([ "110": "Added OneDrive Root to the local database" ]),
|
||||
JSONValue([ "111": "OneDrive Root exists in the database" ]),
|
||||
JSONValue([ "112": "ERROR: Unable to query OneDrive for account details" ]),
|
||||
JSONValue([ "113": "Attempting to create the requested path within OneDrive" ]),
|
||||
JSONValue([ "114": "Attempting to delete the requested path within OneDrive" ]),
|
||||
JSONValue([ "115": "The requested directory to delete was not found on OneDrive - skipping removing the remote directory as it doesn't exist" ]),
|
||||
JSONValue([ "116": "The requested directory to delete was not found in the local database - pushing delete request direct to OneDrive" ]),
|
||||
JSONValue([ "117": "The requested directory to delete was found in the local database. Processing the deletion normally" ]),
|
||||
JSONValue([ "118": "The requested directory to rename was not found on OneDrive" ]),
|
||||
JSONValue([ "119": "Applying changes of Path ID: " ]),
|
||||
JSONValue([ "120": "Updated Remaining Free Space: " ]),
|
||||
JSONValue([ "121": "OneDrive quota information is set at zero, as this is not our drive id, ignoring" ]),
|
||||
JSONValue([ "122": "No details returned for given Path ID" ]),
|
||||
JSONValue([ "123": "ERROR: A potential local database consistency issue has been caught. Please retry your command with '--resync' to fix any local database consistency issues." ]),
|
||||
JSONValue([ "124": "OneDrive returned a 'HTTP 504 - Gateway Timeout' when attempting to query the OneDrive API - retrying the applicable request" ]),
|
||||
JSONValue([ "125": "Processing " ]),
|
||||
JSONValue([ "126": " OneDrive items to ensure consistent local state due to a full scan being triggered by actions on OneDrive" ]),
|
||||
JSONValue([ "127": " OneDrive items to ensure consistent local state due to a full scan being requested" ]),
|
||||
JSONValue([ "128": " OneDrive items to ensure consistent local state" ]),
|
||||
JSONValue([ "129": " OneDrive items to ensure consistent local state due to sync_list being used" ]),
|
||||
JSONValue([ "130": "Number of items from OneDrive to process: " ]),
|
||||
JSONValue([ "131": "Remote change discarded - item cannot be found" ]),
|
||||
JSONValue([ "132": "Remote change discarded - not in --single-directory sync scope (in DB)" ]),
|
||||
JSONValue([ "133": "Remote change discarded - not in sync scope" ]),
|
||||
JSONValue([ "134": "Remote change discarded - not in --single-directory sync scope (not in DB)" ]),
|
||||
JSONValue([ "135": "Remote change discarded - not in business shared folders sync scope" ]),
|
||||
JSONValue([ "136": "Skipping item - file path is excluded by skip_dir config: " ]),
|
||||
JSONValue([ "137": "Skipping item - excluded by skip_file config: " ]),
|
||||
JSONValue([ "138": "Skipping file - parent path not present in local database" ]),
|
||||
JSONValue([ "139": "The Microsoft OneNote Notebook '" ]),
|
||||
JSONValue([ "140": "' is not supported by this client" ]),
|
||||
JSONValue([ "141": "The OneDrive item '" ]),
|
||||
JSONValue([ "142": "Flagging as unwanted: item type is not supported" ]),
|
||||
JSONValue([ "143": "Skipping item - excluded by sync_list config: " ]),
|
||||
JSONValue([ "144": "Flagging item for local delete as item exists in database: " ]),
|
||||
JSONValue([ "145": "Skipping item - .file or .folder: " ]),
|
||||
JSONValue([ "146": "Local item modified time is equal to OneDrive item modified time based on UTC time conversion - keeping local item" ]),
|
||||
JSONValue([ "147": "Local item modified time is newer than OneDrive item modified time based on UTC time conversion - keeping local item" ]),
|
||||
JSONValue([ "148": "Remote item modified time is newer based on UTC time conversion" ]),
|
||||
JSONValue([ "149": "WARNING: Local Data Protection has been disabled by your configuration. You may experience data loss on this file: " ]),
|
||||
JSONValue([ "150": "The local item is out-of-sync with OneDrive, renaming to preserve existing file and prevent data loss: " ]),
|
||||
JSONValue([ "151": "Skipping item - excluded by skip_size config: " ]),
|
||||
JSONValue([ "152": "Local item modified time is newer based on UTC time conversion - keeping local item as this exists in the local database" ]),
|
||||
JSONValue([ "153": "Skipping downloading item - .nosync found in parent folder & --check-for-nosync is enabled: " ]),
|
||||
JSONValue([ "154": "Removing previous partial file download due to .nosync found in parent folder & --check-for-nosync is enabled" ]),
|
||||
JSONValue([ "155": "Local item does not exist in local database - replacing with file from OneDrive - failed download?" ]),
|
||||
JSONValue([ "156": "The local item is out-of-sync with OneDrive, renaming to preserve existing file and prevent data loss due to --resync: " ]),
|
||||
JSONValue([ "157": "Remote item modified time is newer based on UTC time conversion" ]),
|
||||
JSONValue([ "158": "Creating local directory: " ]),
|
||||
JSONValue([ "159": "Moving " ]),
|
||||
JSONValue([ "160": " to " ]),
|
||||
JSONValue([ "161": "Destination is in sync and will be overwritten" ]),
|
||||
JSONValue([ "162": "The destination is occupied, renaming the conflicting file..." ]),
|
||||
JSONValue([ "163": "The destination is occupied by new file, renaming the conflicting file..." ]),
|
||||
JSONValue([ "164": "Downloading file " ]),
|
||||
JSONValue([ "165": "ERROR: Query of OneDrive for file details failed" ]),
|
||||
JSONValue([ "166": "ERROR: MALWARE DETECTED IN FILE - DOWNLOAD SKIPPED" ]),
|
||||
JSONValue([ "167": "ERROR: File download size mis-match. Increase logging verbosity to determine why." ]),
|
||||
JSONValue([ "168": "ERROR: File download hash mis-match. Increase logging verbosity to determine why." ]),
|
||||
JSONValue([ "169": "ERROR: File failed to download. Increase logging verbosity to determine why." ]),
|
||||
JSONValue([ "170": "done." ]),
|
||||
JSONValue([ "171": " ... done." ]),
|
||||
JSONValue([ "172": "The local item has a different modified time " ]),
|
||||
JSONValue([ "173": " when compared to " ]),
|
||||
JSONValue([ "174": " modified time " ]),
|
||||
JSONValue([ "175": "The local item has a different hash when compared to " ]),
|
||||
JSONValue([ "176": " item hash" ]),
|
||||
JSONValue([ "177": "Unable to determine the sync state of this file as it cannot be read (file permissions or file corruption): " ]),
|
||||
JSONValue([ "178": "The local item is a directory but should be a file" ]),
|
||||
JSONValue([ "179": "The local item is a file but should be a directory" ]),
|
||||
JSONValue([ "180": "Trying to delete item " ]),
|
||||
]);
|
||||
|
||||
// Load the message into the array
|
||||
ulong thisMessageID = 0;
|
||||
foreach (translationItem; languageList["list"].array) {
|
||||
thisMessageID++;
|
||||
string responseString = translationItem[to!string(thisMessageID)].str;
|
||||
languageResponsesDefault ~= responseString;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue