From 2daca679b3bc364a5c42feae7b910976fab66714 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 26 Sep 2011 23:24:17 -0400 Subject: [PATCH] I18N - Localized Context. --- src/Context.cpp | 19 ++++++++----------- src/en-US.h | 6 ++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index 392247608..a5e8f7ed7 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -25,6 +25,8 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include @@ -417,24 +419,19 @@ void Context::shadow () // Check for dangerous shadow file settings. std::string location = config.get ("data.location"); if (shadow_file._data == location + "/pending.data") - throw std::string ("Configuration variable 'shadow.file' is set to " - "overwrite your pending tasks. Please change it."); + throw std::string (STRING_CONTEXT_SHADOW_P); if (shadow_file._data == location + "/completed.data") - throw std::string ("Configuration variable 'shadow.file' is set to " - "overwrite your completed tasks. Please change it."); + throw std::string (STRING_CONTEXT_SHADOW_C); if (shadow_file._data == location + "/undo.data") - throw std::string ("Configuration variable 'shadow.file' is set to " - "overwrite your undo log. Please change it."); + throw std::string (STRING_CONTEXT_SHADOW_U); if (shadow_file._data == location + "/backlog.data") - throw std::string ("Configuration variable 'shadow.file' is set to " - "overwrite your backlog file. Please change it."); + throw std::string (STRING_CONTEXT_SHADOW_B); if (shadow_file._data == location + "/synch.key") - throw std::string ("Configuration variable 'shadow.file' is set to " - "overwrite your synch.key file. Please change it."); + throw std::string (STRING_CONTEXT_SHADOW_S); // Compose the command. Put the rc overrides up front, so that they may // be overridden by rc.shadow.command. @@ -452,7 +449,7 @@ void Context::shadow () // Optionally display a notification that the shadow file was updated. // TODO Convert to a verbosity token. if (config.getBoolean ("shadow.notify")) - footnote (std::string ("[Shadow file '") + shadow_file._data + "' updated.]"); + footnote (format (STRING_CONTEXT_SHADOW_UPDATE, shadow_file._data)); } } diff --git a/src/en-US.h b/src/en-US.h index 665f5dba3..2aa3d6f59 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -413,6 +413,12 @@ // Context #define STRING_CONTEXT_CREATE_RC "A configuration file could not be found in {1}\n\nWould you like a sample {2} created, so taskwarrior can proceed?" #define STRING_CONTEXT_NEED_RC "Cannot proceed without rc file." +#define STRING_CONTEXT_SHADOW_P "Configuration variable 'shadow.file' is set to " "overwrite your pending tasks. Please change it." +#define STRING_CONTEXT_SHADOW_C "Configuration variable 'shadow.file' is set to " "overwrite your completed tasks. Please change it." +#define STRING_CONTEXT_SHADOW_U "Configuration variable 'shadow.file' is set to " "overwrite your undo log. Please change it." +#define STRING_CONTEXT_SHADOW_B "Configuration variable 'shadow.file' is set to " "overwrite your backlog file. Please change it." +#define STRING_CONTEXT_SHADOW_S "Configuration variable 'shadow.file' is set to " "overwrite your synch.key file. Please change it." +#define STRING_CONTEXT_SHADOW_UPDATE "[Shadow file '{1}' updated.]" // Date #define STRING_DATE_INVALID_FORMAT "'{1}' is not a valid date in the '{2}' format."