Automatizza la generazione di traduzione memorizzata SQL in Visual Studio 2010
-
16-11-2019 - |
Domanda
Voglio automatizzare il processo di localizzazione della stringa.
Le traduzioni sono memorizzate nel database.
Il problema è che per aggiungere una nuova voce di localizzazione, ho bisogno di completare i passaggi fulmini:
1) Aprire un file che memorizza costanti con la dichiarazione dei tasti.Sembra questo:
public class LocalizationKeys
{
public const string ui_btn_cancel = "ui_btn_cancel";
public const string ui_btn_ok = "ui_btn_ok";
}
.
2) Aprire due script SQL e aggiungi chiamate alle procedure memorizzate, come:
exec AddLocalization(...)
exec AddTranslation(...)
.
Come automatizzare questa routine, supponendo che abbia Resharper 6.1 installato in Visual Studio 2010?Ho pensato a macro, ma non sono sicuro che questa sia una buona idea.Idealemente voglio selezionare una combinazione di hotkey hit stringa immettere un nome chiave e guarda come il computer che fa il suo lavoro.
Soluzione
ReSharper could certainly help you do that, but I'm afraid you'd need to write a small plug-in to so this. The idea would be that you would detect that the cursor is on a constant definition string literal, throw a pop-up box asking for the key, then you'd actually execute the sprocs directly from the plug-in with whatever ADO.NET/ORM you prefer.
If you do decide to go this route, you can download the ReSharper SDK here. Also, check out the plugin development guide.