diff --git a/Locale/en_GB/LC_MESSAGES/SuiteCRMAddIn.mo b/Locale/en_GB/LC_MESSAGES/SuiteCRMAddIn.mo new file mode 100644 index 00000000..7588b996 Binary files /dev/null and b/Locale/en_GB/LC_MESSAGES/SuiteCRMAddIn.mo differ diff --git a/Locale/fr_FR/LC_MESSAGES/SuiteCRMAddIn.mo b/Locale/fr_FR/LC_MESSAGES/SuiteCRMAddIn.mo new file mode 100644 index 00000000..c2e88720 Binary files /dev/null and b/Locale/fr_FR/LC_MESSAGES/SuiteCRMAddIn.mo differ diff --git a/Locale/fr_FR/LC_MESSAGES/SuiteCRMAddIn.po b/Locale/fr_FR/LC_MESSAGES/SuiteCRMAddIn.po new file mode 100644 index 00000000..1a175b5e --- /dev/null +++ b/Locale/fr_FR/LC_MESSAGES/SuiteCRMAddIn.po @@ -0,0 +1,273 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: 2017-06-21 11:12+0100\n" +"PO-Revision-Date: 2017-06-21 11:24+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.2\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: SuiteCRMAddIn/ThisAddIn.cs:108 +#, fuzzy +msgid "Licence key was not yet set up" +msgstr "Clé de licence n’est pas encore configuré" + +#: SuiteCRMAddIn/ThisAddIn.cs:184 +#, fuzzy +msgid "Archive" +msgstr "Archive" + +#: SuiteCRMAddIn/ThisAddIn.cs:189 +#, fuzzy +msgid "Archive selected emails to SuiteCRM" +msgstr "Archiver les emails sélectionnés pour SuiteCRM" + +#: SuiteCRMAddIn/ThisAddIn.cs:193 +#, fuzzy +msgid "Settings" +msgstr "Paramètres" + +#: SuiteCRMAddIn/ThisAddIn.cs:197 +#, fuzzy +msgid "SuiteCRM Settings" +msgstr "Paramètres de SuiteCRM" + +#: SuiteCRMAddIn/ThisAddIn.cs:217 +#, fuzzy +msgid "Licence verified..." +msgstr "Licence vérifié..." + +#: SuiteCRMAddIn/ThisAddIn.cs:223 +#, fuzzy +msgid "Authentication succeeded..." +msgstr "L’authentification a réussi..." + +#: SuiteCRMAddIn/ThisAddIn.cs:227 SuiteCRMAddIn/ThisAddIn.cs:433 +#, fuzzy +msgid "Login to CRM failed" +msgstr "Échec de la connexion à CRM" + +#: SuiteCRMAddIn/ThisAddIn.cs:228 +#, fuzzy +msgid "" +"User chose to disable add-in after licence check succeeded but login to CRM " +"failed." +msgstr "" +"L’utilisateur a choisi de désactiver le composant logiciel enfichable après " +"vérification de licence a réussi, mais échec de la connexion à CRM." + +#: SuiteCRMAddIn/ThisAddIn.cs:233 SuiteCRMAddIn/ThisAddIn.cs:440 +#, fuzzy +msgid "Licence check failed" +msgstr "Échec de la vérification !" + +#: SuiteCRMAddIn/ThisAddIn.cs:234 +#, fuzzy +msgid "User chose to disable add-in after licence check failed." +msgstr "" +"L’utilisateur a choisi de désactiver le composant logiciel enfichable après " +"que vérification de la licence a échoué." + +#: SuiteCRMAddIn/ThisAddIn.cs:240 +#, fuzzy +msgid "Starting normal operations." +msgstr "Mise en service normal." + +#: SuiteCRMAddIn/ThisAddIn.cs:248 +#, fuzzy +msgid "Disabling addin at user request" +msgstr "Désactiver le complément à la demande de l’utilisateur" + +#: SuiteCRMAddIn/ThisAddIn.cs:258 +#, fuzzy, csharp-format +msgid "In {0}: success is {1}; disable is {2}; impossible state, disabling." +msgstr "" +"Dans {0} : le succès est {1} ; Disable est {2} ; État de l’impossible, la " +"désactivation." + +#: SuiteCRMAddIn/ThisAddIn.cs:269 +#, fuzzy +msgid "Disabling add-in" +msgstr "Désactivation de composant logiciel enfichable" + +#: SuiteCRMAddIn/ThisAddIn.cs:276 +#, fuzzy, csharp-format +msgid "{0}: Disabling instance {1} of addin {2}" +msgstr "{0} : désactivation d’instance {1} d’addin {2}" + +#: SuiteCRMAddIn/ThisAddIn.cs:281 +#, fuzzy, csharp-format +msgid "{0}: Ignoring addin {1}" +msgstr "{0} : ignorant addin {1}" + +#: SuiteCRMAddIn/ThisAddIn.cs:302 +#, fuzzy +msgid "User chose to reconfigure add-in" +msgstr "L’utilisateur a choisi de reconfigurer composant logiciel enfichable" + +#: SuiteCRMAddIn/ThisAddIn.cs:307 +#, fuzzy +msgid "User chose to disable add-in" +msgstr "L’utilisateur a choisi de désactiver le composant logiciel enfichable" + +#: SuiteCRMAddIn/ThisAddIn.cs:311 +#, fuzzy +msgid "Unexpected response from ReconfigureOrDisableDialog" +msgstr "Réponse inattendue de ReconfigureOrDisableDialog" + +#: SuiteCRMAddIn/ThisAddIn.cs:343 +#, fuzzy, csharp-format +msgid "{0} v{1} in Outlook version {2}" +msgstr "" +"version\n" +" de {0} {1} dans Outlook version {2}" + +#: SuiteCRMAddIn/ThisAddIn.cs:348 +#, fuzzy, csharp-format +msgid "Exception {0} '{1}' while printing log header" +msgstr "Exception {0} « {1} » tout en en-tête du journal d’impression" + +#: SuiteCRMAddIn/ThisAddIn.cs:356 +#, fuzzy +msgid "Auto-archiving: " +msgstr "Archivage:" + +#: SuiteCRMAddIn/ThisAddIn.cs:357 +#, fuzzy +msgid "ON" +msgstr "ACTIVE" + +#: SuiteCRMAddIn/ThisAddIn.cs:357 +#, fuzzy +msgid "off" +msgstr "désactivé" + +#: SuiteCRMAddIn/ThisAddIn.cs:358 +#, fuzzy, csharp-format +msgid "Logging level: {0}" +msgstr "Niveau de journalisation: {0}" + +#: SuiteCRMAddIn/ThisAddIn.cs:375 +#, fuzzy +msgid "Starting appointments synchroniser" +msgstr "À partir de synchroniser des nominations" + +#: SuiteCRMAddIn/ThisAddIn.cs:376 +#, fuzzy +msgid "Starting contacts synchroniser" +msgstr "À partir de synchroniser contacts" + +#: SuiteCRMAddIn/ThisAddIn.cs:377 +#, fuzzy +msgid "Starting tasks synchroniser" +msgstr "À partir de synchroniser des tâches" + +#: SuiteCRMAddIn/ThisAddIn.cs:378 +#, fuzzy +msgid "Starting email archiver" +msgstr "Archiveur de courrier départ" + +#: SuiteCRMAddIn/ThisAddIn.cs:454 +#, fuzzy, csharp-format +msgid "{0}: signalled to quit." +msgstr "{0} : signalée d’arrêter." + +#: SuiteCRMAddIn/ThisAddIn.cs:458 SuiteCRMAddIn/ThisAddIn.cs:474 +#, fuzzy, csharp-format +msgid "{0}: shutdown complete." +msgstr "{0} : arrêt complet." + +#: SuiteCRMAddIn/ThisAddIn.cs:470 +#, fuzzy, csharp-format +msgid "{0}: shutting down normally." +msgstr "{0} : fermer normalement." + +#: SuiteCRMAddIn/ThisAddIn.cs:486 +#, fuzzy, csharp-format +msgid "{0}: Removing SuiteCRM command bar" +msgstr "{0} : enlever la barre de commandes de SuiteCRM" + +#: SuiteCRMAddIn/ThisAddIn.cs:522 +#, fuzzy +msgid "ShutdownProcesses: complete" +msgstr "ShutdownProcesses : complet" + +#: SuiteCRMAddIn/ThisAddIn.cs:530 +#, fuzzy, csharp-format +msgid "{0}: Removing context menu display event handler" +msgstr "{0} : suppression contexte menu Affichage événement gestionnaire" + +#: SuiteCRMAddIn/ThisAddIn.cs:544 +#, fuzzy, csharp-format +msgid "{0}: Removing new mail event handler" +msgstr "{0} : suppression nouveau gestionnaire d’événements courrier" + +#: SuiteCRMAddIn/ThisAddIn.cs:561 +#, fuzzy, csharp-format +msgid "{0}: Removing archive item send event handler" +msgstr "" +"{0} : suppression d’élément archive envoyer le gestionnaire d’événements" + +#: SuiteCRMAddIn/ThisAddIn.cs:577 +#, fuzzy, csharp-format +msgid "{0}: Removing archive button click event handler" +msgstr "{0} : enlever le bouton archive de gestionnaire d’événements click" + +#: SuiteCRMAddIn/ThisAddIn.cs:599 +#, fuzzy, csharp-format +msgid "{0}: Disposing of {1}" +msgstr "{0} : élimination de {1}" + +#: SuiteCRMAddIn/ThisAddIn.cs:604 +#, fuzzy, csharp-format +msgid "{0}: Failed to dispose of instance of {1}" +msgstr "{0} : impossible de supprimer l’instance de {1}" + +#: SuiteCRMAddIn/ThisAddIn.cs:609 +#, fuzzy, csharp-format +msgid "{0}: Attempt to dispose of null reference?" +msgstr "{0} : tenter d’éliminer des référence null ?" + +#: SuiteCRMAddIn/ThisAddIn.cs:635 +#, fuzzy +msgid "SuiteCRM Archive" +msgstr "SuiteCRM Archive" + +#: SuiteCRMAddIn/ThisAddIn.cs:660 +#, fuzzy +msgid "Outlook ItemSend: email sent event" +msgstr "ItemSend Outlook : événement e-mail envoyé" + +#: SuiteCRMAddIn/ThisAddIn.cs:673 +msgid "ThisAddIn.Application_ItemSend" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:679 +#, fuzzy +msgid "Outlook NewMail: email received event" +msgstr "Outlook NewMail : événement reçu de courrier électronique" + +#: SuiteCRMAddIn/ThisAddIn.cs:692 +msgid "ThisAddIn.Application_NewMail" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:700 +#, fuzzy +msgid "New 'mail item' was null" +msgstr "Nouveau « envoi postal » avait la valeur null" + +#: SuiteCRMAddIn/ThisAddIn.cs:768 +#, fuzzy +msgid "Failure while trying to authenticate to CRM" +msgstr "Échec en essayant de s’authentifier sur le CRM" + +#: SuiteCRMAddIn/ThisAddIn.cs:769 +#, fuzzy +msgid "Login failure" +msgstr "Échec de connexion - {0}" diff --git a/SuiteCRMAddIn.pot b/SuiteCRMAddIn.pot new file mode 100644 index 00000000..3e0b5046 --- /dev/null +++ b/SuiteCRMAddIn.pot @@ -0,0 +1,235 @@ +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: SuiteCRM-Outlook-Plugin\n" +"POT-Creation-Date: 2017-06-21 10:45+0100\n" +"PO-Revision-Date: 2017-06-21 09:52+0100\n" +"Last-Translator: \n" +"Language-Team: info@salesagility.com\n" +"Language: en_GB\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 2.0.2\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-SearchPath-0: SuiteCRMAddIn\n" +"X-Poedit-SearchPath-1: SuiteCRMClient\n" + +#: SuiteCRMAddIn/ThisAddIn.cs:108 +msgid "Licence key was not yet set up" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:184 +msgid "Archive" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:189 +msgid "Archive selected emails to SuiteCRM" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:193 +msgid "Settings" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:197 +msgid "SuiteCRM Settings" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:217 +msgid "Licence verified..." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:223 +msgid "Authentication succeeded..." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:227 SuiteCRMAddIn/ThisAddIn.cs:433 +msgid "Login to CRM failed" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:228 +msgid "User chose to disable add-in after licence check succeeded but login to CRM failed." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:233 SuiteCRMAddIn/ThisAddIn.cs:440 +msgid "Licence check failed" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:234 +msgid "User chose to disable add-in after licence check failed." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:240 +msgid "Starting normal operations." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:248 +msgid "Disabling addin at user request" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:258 +#, csharp-format +msgid "In {0}: success is {1}; disable is {2}; impossible state, disabling." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:269 +msgid "Disabling add-in" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:276 +#, csharp-format +msgid "{0}: Disabling instance {1} of addin {2}" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:281 +#, csharp-format +msgid "{0}: Ignoring addin {1}" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:302 +msgid "User chose to reconfigure add-in" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:307 +msgid "User chose to disable add-in" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:311 +msgid "Unexpected response from ReconfigureOrDisableDialog" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:343 +#, csharp-format +msgid "{0} v{1} in Outlook version {2}" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:348 +#, csharp-format +msgid "Exception {0} '{1}' while printing log header" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:356 +msgid "Auto-archiving: " +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:357 +msgid "ON" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:357 +msgid "off" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:358 +#, csharp-format +msgid "Logging level: {0}" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:375 +msgid "Starting appointments synchroniser" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:376 +msgid "Starting contacts synchroniser" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:377 +msgid "Starting tasks synchroniser" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:378 +msgid "Starting email archiver" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:454 +#, csharp-format +msgid "{0}: signalled to quit." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:458 SuiteCRMAddIn/ThisAddIn.cs:474 +#, csharp-format +msgid "{0}: shutdown complete." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:470 +#, csharp-format +msgid "{0}: shutting down normally." +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:486 +#, csharp-format +msgid "{0}: Removing SuiteCRM command bar" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:522 +msgid "ShutdownProcesses: complete" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:530 +#, csharp-format +msgid "{0}: Removing context menu display event handler" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:544 +#, csharp-format +msgid "{0}: Removing new mail event handler" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:561 +#, csharp-format +msgid "{0}: Removing archive item send event handler" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:577 +#, csharp-format +msgid "{0}: Removing archive button click event handler" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:599 +#, csharp-format +msgid "{0}: Disposing of {1}" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:604 +#, csharp-format +msgid "{0}: Failed to dispose of instance of {1}" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:609 +#, csharp-format +msgid "{0}: Attempt to dispose of null reference?" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:635 +msgid "SuiteCRM Archive" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:660 +msgid "Outlook ItemSend: email sent event" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:673 +msgid "ThisAddIn.Application_ItemSend" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:679 +msgid "Outlook NewMail: email received event" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:692 +msgid "ThisAddIn.Application_NewMail" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:700 +msgid "New 'mail item' was null" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:768 +msgid "Failure while trying to authenticate to CRM" +msgstr "" + +#: SuiteCRMAddIn/ThisAddIn.cs:769 +msgid "Login failure" +msgstr "" diff --git a/SuiteCRMAddIn/SuiteCRMAddIn.csproj b/SuiteCRMAddIn/SuiteCRMAddIn.csproj index a13ff880..e64c5d8f 100644 --- a/SuiteCRMAddIn/SuiteCRMAddIn.csproj +++ b/SuiteCRMAddIn/SuiteCRMAddIn.csproj @@ -142,7 +142,11 @@ True - ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + True + + + ..\packages\NGettext.0.6.2\lib\net45\NGettext.dll True diff --git a/SuiteCRMAddIn/ThisAddIn.cs b/SuiteCRMAddIn/ThisAddIn.cs index 34db9c52..4a9f3b3c 100644 --- a/SuiteCRMAddIn/ThisAddIn.cs +++ b/SuiteCRMAddIn/ThisAddIn.cs @@ -41,6 +41,7 @@ namespace SuiteCRMAddIn using System.Windows.Forms; using Office = Microsoft.Office.Core; using Outlook = Microsoft.Office.Interop.Outlook; + using NGettext; public partial class ThisAddIn { @@ -59,6 +60,11 @@ public partial class ThisAddIn private TaskSyncing taskSynchroniser; private AppointmentSyncing appointmentSynchroniser; + /// + /// Internationalisation (118n) strings dictionary + /// + public ICatalog catalogue = new Catalog(ProgId, "./Locale"); + public Office.IRibbonUI RibbonUI { get; set; } public EmailArchiving EmailArchiver { @@ -99,7 +105,7 @@ private bool VerifyLicenceKey() result = new LicenceValidationHelper(this.Log, Properties.Settings.Default.PublicKey, Properties.Settings.Default.LicenceKey).Validate(); } catch (System.Configuration.SettingsPropertyNotFoundException ex) { - this.log.Error("Licence key was not yet set up", ex); + this.log.Error(catalogue.GetString("Licence key was not yet set up"), ex); } return result; } @@ -175,20 +181,20 @@ private void ConstructOutlook2007MenuBar() objSuiteCRMMenuBar2007.Caption = "SuiteCRM"; this.btnArchive = (Office.CommandBarButton)this.objSuiteCRMMenuBar2007.Controls.Add(Office.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); this.btnArchive.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; - this.btnArchive.Caption = "Archive"; + this.btnArchive.Caption = catalogue.GetString("Archive"); this.btnArchive.Picture = RibbonImageHelper.Convert(Resources.SuiteCRMLogo); this.btnArchive.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.cbtnArchive_Click); this.btnArchive.Visible = true; this.btnArchive.BeginGroup = true; - this.btnArchive.TooltipText = "Archive selected emails to SuiteCRM"; + this.btnArchive.TooltipText = catalogue.GetString("Archive selected emails to SuiteCRM"); this.btnArchive.Enabled = true; this.btnSettings = (Office.CommandBarButton)this.objSuiteCRMMenuBar2007.Controls.Add(Office.MsoControlType.msoControlButton, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); this.btnSettings.Style = Office.MsoButtonStyle.msoButtonIconAndCaption; - this.btnSettings.Caption = "Settings"; + this.btnSettings.Caption = catalogue.GetString("Settings"); this.btnSettings.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.cbtnSettings_Click); this.btnSettings.Visible = true; this.btnSettings.BeginGroup = true; - this.btnSettings.TooltipText = "SuiteCRM Settings"; + this.btnSettings.TooltipText = catalogue.GetString("SuiteCRM Settings"); this.btnSettings.Enabled = true; this.btnSettings.Picture = RibbonImageHelper.Convert(Resources.Settings); @@ -208,30 +214,30 @@ private void Run() if (success) { - log.Info("Licence verified..."); + log.Info(catalogue.GetString("Licence verified...")); success = this.SuiteCRMAuthenticate(); if (success) { - log.Info("Authentication succeeded..."); + log.Info(catalogue.GetString("Authentication succeeded...")); } else { - disable = this.ShowReconfigureOrDisable("Login to CRM failed"); - Log.Info("User chose to disable add-in after licence check succeeded but login to CRM failed."); + disable = this.ShowReconfigureOrDisable(catalogue.GetString("Login to CRM failed")); + Log.Info(catalogue.GetString("User chose to disable add-in after licence check succeeded but login to CRM failed.")); } } else { - disable = this.ShowReconfigureOrDisable("Licence check failed"); - Log.Info("User chose to disable add-in after licence check failed."); + disable = this.ShowReconfigureOrDisable(catalogue.GetString("Licence check failed")); + Log.Info(catalogue.GetString("User chose to disable add-in after licence check failed.")); } } if (success && !disable) { - log.Info("Starting normal operations."); + log.Info(catalogue.GetString("Starting normal operations.")); DaemonWorker.Instance.AddTask(new FetchEmailCategoriesAction()); StartSynchronisationProcesses(); @@ -239,33 +245,40 @@ private void Run() } else if (disable) { - log.Info("Disabling addin at user request"); + log.Info(catalogue.GetString("Disabling addin at user request")); this.Disable(); } else { /* it's possible for both success AND disable to be true (if login to CRM fails); - * but logically if success is false disabel must be true, so this branch should + * but logically if success is false disable must be true, so this branch should * never be reached. */ - log.Error($"In ThisAddIn.Run: success is {success}; disable is {disable}; impossible state, disabling."); + log.Error( + catalogue.GetString( + "In {0}: success is {1}; disable is {2}; impossible state, disabling.", + "ThisAddIn.Run", + success, + disable)); + this.Disable(); } } private void Disable() { - Log.Warn("Disabling add-in"); + const string methodName = "ThisAddIn.Disable"; + Log.Warn(catalogue.GetString("Disabling add-in")); int i = 0; foreach (COMAddIn addin in Application.COMAddIns) { if (ProgId.Equals(addin.ProgId)) { - Log.Debug($"ThisAddIn.Disable: Disabling instance {++i} of addin {ProgId}"); + Log.Debug(catalogue.GetString("{0}: Disabling instance {1} of addin {2}", methodName, ++i, ProgId)); addin.Connect = false; } else { - Log.Debug($"ThisAddIn.Disable: Ignoring addin {addin.ProgId}"); + Log.Debug(catalogue.GetString("{0}: Ignoring addin {1}", methodName, addin.ProgId)); } } @@ -286,16 +299,16 @@ private bool ShowReconfigureOrDisable(string summary) case DialogResult.OK: /* if licence key does not validate, show the settings form to allow the user to enter * a (new) key, and retry. */ - Log.Info("User chose to reconfigure add-in"); + Log.Info(catalogue.GetString("User chose to reconfigure add-in")); this.ShowSettingsForm(); result = false; break; case DialogResult.Cancel: - Log.Info("User chose to disable add-in"); + Log.Info(catalogue.GetString("User chose to disable add-in")); result = true; break; default: - log.Warn("Unexpected response from ReconfigureOrDisableDialog"); + log.Warn(catalogue.GetString("Unexpected response from ReconfigureOrDisableDialog")); result = true; break; } @@ -327,12 +340,12 @@ private IEnumerable GetLogHeader() try { - result.Add($"{AddInTitle} v{AddInVersion} in Outlook version {this.Application.Version}"); + result.Add(catalogue.GetString("{0} v{1} in Outlook version {2}", AddInTitle, AddInVersion, this.Application.Version)); result.AddRange(GetKeySettings()); } catch (Exception any) { - result.Add($"Exception {any.GetType().Name} '{any.Message}' while printing log header"); + result.Add(catalogue.GetString("Exception {0} '{1}' while printing log header", any.GetType().Name, any.Message)); } return result; @@ -340,8 +353,9 @@ private IEnumerable GetLogHeader() private IEnumerable GetKeySettings() { - yield return "Auto-archiving: " + (Properties.Settings.Default.AutoArchive ? "ON" : "off"); - yield return $"Logging level: {Properties.Settings.Default.LogLevel}"; + yield return catalogue.GetString("Auto-archiving: ") + + (Settings.Default.AutoArchive ? catalogue.GetString("ON") : catalogue.GetString("off")); + yield return catalogue.GetString("Logging level: {0}", Settings.Default.LogLevel); } void objExplorer_FolderSwitch() @@ -358,10 +372,10 @@ void objExplorer_FolderSwitch() public void StartSynchronisationProcesses() { - DoOrLogError(() => this.appointmentSynchroniser.Start(), "Starting appointments synchroniser"); - DoOrLogError(() => this.contactSynchroniser.Start(), "Starting contacts synchroniser"); - DoOrLogError(() => this.taskSynchroniser.Start(), "Starting tasks synchroniser"); - DoOrLogError(() => this.EmailArchiver.Start(), "Starting email archiver"); + DoOrLogError(() => this.appointmentSynchroniser.Start(), catalogue.GetString("Starting appointments synchroniser")); + DoOrLogError(() => this.contactSynchroniser.Start(), catalogue.GetString("Starting contacts synchroniser")); + DoOrLogError(() => this.taskSynchroniser.Start(), catalogue.GetString("Starting tasks synchroniser")); + DoOrLogError(() => this.EmailArchiver.Start(), catalogue.GetString("Starting email archiver")); } private void cbtnArchive_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault) @@ -416,14 +430,14 @@ private void ReconfigureOrDisable() { if (!HasCrmUserSession) { - if (this.ShowReconfigureOrDisable("Login to CRM failed")) + if (this.ShowReconfigureOrDisable(catalogue.GetString("Login to CRM failed"))) { this.Disable(); } } else if (!IsLicensed) { - if (this.ShowReconfigureOrDisable("Licence check failed")) + if (this.ShowReconfigureOrDisable(catalogue.GetString("Licence check failed"))) { this.Disable(); } @@ -435,11 +449,13 @@ private void ReconfigureOrDisable() /// private void ThisAddIn_Quit() { - Log.Info("ThisAddIn_Quit: signalled to quit"); + const string methodName = "ThisAddIn_Quit"; + + Log.Info(catalogue.GetString("{0}: signalled to quit.", methodName)); this.ShutdownAll(); - log.Info("ThisAddIn_Quit: shutdown complete."); + log.Info(catalogue.GetString("{0}: shutdown complete.", methodName)); } /// @@ -450,11 +466,12 @@ private void ThisAddIn_Quit() /// private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { - Log.Info("ThisAddIn_Shutdown: shutting down normally"); + const string methodName = "ThisAddIn_Shutdown"; + Log.Info(catalogue.GetString("{0}: shutting down normally.", methodName)); ShutdownAll(); - log.Info("ThisAddIn_Shutdown: shutdown complete."); + log.Info(catalogue.GetString("{0}: shutdown complete.", methodName)); } /// @@ -466,7 +483,7 @@ private void ShutdownAll() { if (this.CommandBarExists("SuiteCRM")) { - Log.Info("ThisAddIn_Shutdown: Removing SuiteCRM command bar"); + Log.Info(catalogue.GetString("{0}: Removing SuiteCRM command bar", "ThisAddIn_ShutdownAll")); this.objSuiteCRMMenuBar2007.Delete(); } @@ -502,19 +519,21 @@ private void ShutdownProcesses() new ShuttingDownDialog(stillToDo, this.log).ShowDialog(); } - log.Debug("ShutdownProcesses: complete"); + log.Debug(catalogue.GetString("ShutdownProcesses: complete")); } private void UnregisterEvents() { + const string methodName = "ThisAddIn.UnregisterEvents"; try { - Log.Info("ThisAddIn.UnregisterEvents: Removing context menu display event handler"); - this.Application.ItemContextMenuDisplay -= new Outlook.ApplicationEvents_11_ItemContextMenuDisplayEventHandler(this.Application_ItemContextMenuDisplay); + Log.Info(catalogue.GetString("{0}: Removing context menu display event handler", methodName)); + this.Application.ItemContextMenuDisplay -= + new Outlook.ApplicationEvents_11_ItemContextMenuDisplayEventHandler(this.Application_ItemContextMenuDisplay); } catch (Exception ex) { - log.Error("ThisAddIn.UnregisterEvents", ex); + log.Error(methodName, ex); } UnregisterButtonClickHandler(this.btnArchive, this.cbtnArchive_Click); @@ -522,9 +541,10 @@ private void UnregisterEvents() try { - Log.Info("ThisAddIn.UnregisterEvents: Removing new mail event handler"); + Log.Info(catalogue.GetString("{0}: Removing new mail event handler", methodName)); - Outlook.ApplicationEvents_11_NewMailExEventHandler handler = new Outlook.ApplicationEvents_11_NewMailExEventHandler(this.Application_NewMail); + Outlook.ApplicationEvents_11_NewMailExEventHandler handler = + new Outlook.ApplicationEvents_11_NewMailExEventHandler(this.Application_NewMail); if (handler != null) { @@ -533,32 +553,33 @@ private void UnregisterEvents() } catch (Exception ex) { - log.Error("ThisAddIn.UnregisterEvents", ex); + log.Error(methodName, ex); } try { - Log.Info("ThisAddIn.UnregisterEvents: Removing archive item send event handler"); + Log.Info(catalogue.GetString("{0}: Removing archive item send event handler", methodName)); this.objExplorer.Application.ItemSend -= new Outlook.ApplicationEvents_11_ItemSendEventHandler(this.Application_ItemSend); } catch (Exception ex) { - log.Error("ThisAddIn.UnregisterEvents", ex); + log.Error(methodName, ex); } } private void UnregisterButtonClickHandler(CommandBarButton button, _CommandBarButtonEvents_ClickEventHandler clickHandler) { + string methodName = "ThisAddIn.UnregisterButtonClickHandler"; if (button != null) { try { - Log.Info("ThisAddIn.UnregisterEvents: Removing archive button click event handler"); + Log.Info(catalogue.GetString("{0}: Removing archive button click event handler", methodName)); button.Click -= new Office._CommandBarButtonEvents_ClickEventHandler(clickHandler); } catch (Exception ex) { - log.Error("ThisAddIn.UnregisterEvents", ex); + log.Error(methodName, ex); } } } @@ -569,21 +590,23 @@ private void UnregisterButtonClickHandler(CommandBarButton button, _CommandBarBu /// The object of which to dispose. private void DisposeOf(IDisposable toDispose) { + string methodName = "ThisAddIn.DisposeOf"; + if (toDispose != null) { try { - Log.Debug($"ThisAddIn.DisposeOf: Disposing of {toDispose.GetType().Name}"); + Log.Debug(catalogue.GetString("{0}: Disposing of {1}", methodName, toDispose.GetType().Name)); toDispose.Dispose(); } catch (Exception ex) { - log.Error($"ThisAddIn.DisposeOf: Failed to dispose of instance of {toDispose.GetType().Name}", ex); + log.Error(catalogue.GetString("{0}: Failed to dispose of instance of {1}", methodName, toDispose.GetType().Name), ex); } } else { - log.Error("ThisAddIn.DisposeOf: Attempt to dispose of null reference?"); + log.Error(catalogue.GetString("{0}: Attempt to dispose of null reference?", methodName)); } } @@ -609,7 +632,7 @@ private void Application_ItemContextMenuDisplay(Office.CommandBar CommandBar, Ou Outlook.Selection selection = Selection; Outlook.MailItem item1 = (Outlook.MailItem)selection[1]; Office.CommandBarButton objMainMenu = (Office.CommandBarButton)CommandBar.Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlButton, this.missing, this.missing, this.missing, this.missing); - objMainMenu.Caption = "SuiteCRM Archive"; + objMainMenu.Caption = catalogue.GetString("SuiteCRM Archive"); objMainMenu.Visible = true; objMainMenu.Picture = RibbonImageHelper.Convert(Resources.SuiteCRMLogo); objMainMenu.Click += new Office._CommandBarButtonEvents_ClickEventHandler(this.contextMenuArchiveButton_Click); @@ -634,7 +657,7 @@ private void contextMenuArchiveButton_Click(Office.CommandBarButton Ctrl, ref bo private void Application_ItemSend(object item, ref bool target) { - log.Debug("Outlook ItemSend: email sent event"); + log.Debug(catalogue.GetString("Outlook ItemSend: email sent event")); try { if (this.IsLicensed && Properties.Settings.Default.AutoArchive) @@ -647,13 +670,13 @@ private void Application_ItemSend(object item, ref bool target) } catch (Exception ex) { - log.Error("ThisAddIn.Application_ItemSend", ex); + log.Error(catalogue.GetString("ThisAddIn.Application_ItemSend"), ex); } } private void Application_NewMail(string EntryID) { - log.Debug("Outlook NewMail: email received event"); + log.Debug(catalogue.GetString("Outlook NewMail: email received event")); try { if (this.IsLicensed && Properties.Settings.Default.AutoArchive) @@ -666,7 +689,7 @@ private void Application_NewMail(string EntryID) } catch (Exception ex) { - log.Error("ThisAddIn.Application_NewMail", ex); + log.Error(catalogue.GetString("ThisAddIn.Application_NewMail"), ex); } } @@ -674,7 +697,7 @@ private void ProcessNewMailItem(EmailArchiveReason archiveType, Outlook.MailItem { if (mailItem == null) { - log.Info("New 'mail item' was null"); + log.Info(catalogue.GetString("New 'mail item' was null")); return; } else @@ -740,7 +763,10 @@ public bool Authenticate() } catch (Exception any) { - ShowAndLogError(any, "Failure while trying to authenticate to CRM", "Login failure"); + ShowAndLogError( + any, + catalogue.GetString("Failure while trying to authenticate to CRM"), + catalogue.GetString("Login failure")); } } else diff --git a/SuiteCRMAddIn/packages.config b/SuiteCRMAddIn/packages.config index 4e7bd243..779e4fda 100644 --- a/SuiteCRMAddIn/packages.config +++ b/SuiteCRMAddIn/packages.config @@ -1,6 +1,7 @@  - + + \ No newline at end of file diff --git a/SuiteCRMAddInTests/SuiteCRMAddInTests.csproj b/SuiteCRMAddInTests/SuiteCRMAddInTests.csproj index af6a1ebb..80ac98fc 100644 --- a/SuiteCRMAddInTests/SuiteCRMAddInTests.csproj +++ b/SuiteCRMAddInTests/SuiteCRMAddInTests.csproj @@ -35,6 +35,10 @@ 4 + + ..\packages\NGettext.0.6.2\lib\net45\NGettext.dll + True + @@ -77,6 +81,7 @@ + PublicSettingsSingleFileGenerator Settings.Designer.cs diff --git a/SuiteCRMAddInTests/packages.config b/SuiteCRMAddInTests/packages.config new file mode 100644 index 00000000..e1ed0955 --- /dev/null +++ b/SuiteCRMAddInTests/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/SuiteCRMClient/SuiteCRMClient.csproj b/SuiteCRMClient/SuiteCRMClient.csproj index 9d41580d..dc7e0b14 100644 --- a/SuiteCRMClient/SuiteCRMClient.csproj +++ b/SuiteCRMClient/SuiteCRMClient.csproj @@ -43,7 +43,11 @@ True - ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + True + + + ..\packages\NGettext.0.6.2\lib\net45\NGettext.dll True diff --git a/SuiteCRMClient/packages.config b/SuiteCRMClient/packages.config index b67dd00f..1c684bf3 100644 --- a/SuiteCRMClient/packages.config +++ b/SuiteCRMClient/packages.config @@ -1,5 +1,6 @@  - + + \ No newline at end of file