diff --git a/devdocs/specs/core-localization.txt b/devdocs/specs/core-localization.txt
index cee4c8d6..e3f34b7f 100644
--- a/devdocs/specs/core-localization.txt
+++ b/devdocs/specs/core-localization.txt
@@ -95,10 +95,13 @@ CHANGES:
- If the text is changed at the server then a notification should occur for clients using that local to invalidate their cache
- Although, that would be a pretty rare event so...maybe not so much, a logout could clear the cache or a login I guess
-
+***********************************************************************************************************************************
LOCALIZED TEXT KEYS ACTUALLY USED
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+Here are the localized text keys in RAVEN that have been specified for use at any level.
+
+
NewKeyValue, OldKeyValue
------------------------
diff --git a/devdocs/todo.txt b/devdocs/todo.txt
index c0659bb1..c601cf19 100644
--- a/devdocs/todo.txt
+++ b/devdocs/todo.txt
@@ -28,11 +28,7 @@ Once that is done then can steam ahead on the biz objects but until I have the c
IMMEDIATE ITEMS:
================
- - Need an ObjectExists type object for checking if something exists when specified by type and ID
- - Could this be a combined method to get the name as well just to save time?
- - Or should that be another method (YES, first code a translator to translate types to db tables (however the fuck that works with EF),
- then can use it in turn to verify existance and get name separately)
- - Once we have that go back into any code that accepts a typeandid and add to Validation code to check for it
+
- Localized text
- ** DEVISE a system to ensure no unused keys are brought forward to raven
- Search and search text indexing
diff --git a/server/AyaNova/Controllers/LocaleController.cs b/server/AyaNova/Controllers/LocaleController.cs
index e9983dbb..13fdd06a 100644
--- a/server/AyaNova/Controllers/LocaleController.cs
+++ b/server/AyaNova/Controllers/LocaleController.cs
@@ -108,6 +108,30 @@ namespace AyaNova.Api.Controllers
}
+#if (DEBUG)
+ ///
+ /// Get all unique Locale keys that were tracked
+ /// Required roles: Any
+ ///
+ ///
+ /// List in alphabetical order of all unique locale keys requested since last server reboot
+ [HttpGet("RequestedKeyList")]
+ public ActionResult RequestedKeyList()
+ {
+ if (serverState.IsClosed)
+ {
+ return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
+ }
+
+ //Instantiate the business object handler
+ LocaleBiz biz = new LocaleBiz(ct, UserIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
+
+ var l = biz.RequestedKeyList();
+ return Ok(new ApiOkResponse(l));
+ }
+#endif
+
+
///
/// Get subset of locale values
/// Required roles: Any
diff --git a/server/AyaNova/biz/AyaType.cs b/server/AyaNova/biz/AyaType.cs
index aa40325c..1c58201b 100644
--- a/server/AyaNova/biz/AyaType.cs
+++ b/server/AyaNova/biz/AyaType.cs
@@ -37,6 +37,7 @@ namespace AyaNova.Biz
//AyaNova.Biz.BizObjectExistsInDatabase
//AyaNova.Biz.BizObjectFactory
//AyaNova.Biz.BizRoles
+ //AyaNova.Biz.BizObjectNameFetcher
}
diff --git a/server/AyaNova/biz/LocaleBiz.cs b/server/AyaNova/biz/LocaleBiz.cs
index 4b9f18b0..6d2b9cf4 100644
--- a/server/AyaNova/biz/LocaleBiz.cs
+++ b/server/AyaNova/biz/LocaleBiz.cs
@@ -97,9 +97,39 @@ namespace AyaNova.Biz
}
+#if (DEBUG)
+ internal List RequestedKeyList()
+ {
+ return ServerBootConfig.LocaleKeysRequested;
+ }
+
+ //Track requests for keys so we can determine which are being used and which are not
+ //TODO: Ideally this should be paired with tests that either directly request each key that are def. being used
+ //or the UI needs to be tested in a way that triggers every key to be used even errors etc
+ internal static void TrackRequestedKey(string key)
+ {
+ if (!ServerBootConfig.LocaleKeysRequested.Contains(key))
+ ServerBootConfig.LocaleKeysRequested.Add(key);
+ }
+
+ internal static void TrackRequestedKey(List keys)
+ {
+ foreach (string Key in keys)
+ {
+ if (!ServerBootConfig.LocaleKeysRequested.Contains(Key))
+ ServerBootConfig.LocaleKeysRequested.Add(Key);
+ }
+ }
+
+#endif
+
//Get the keys for a list of keys provided
internal async Task>> GetSubset(AyaNova.Api.Controllers.LocaleController.LocaleSubsetParam param)
{
+
+#if (DEBUG)
+ TrackRequestedKey(param.Keys);
+#endif
var ret = await ct.LocaleItem.Where(x => x.LocaleId == param.LocaleId && param.Keys.Contains(x.Key)).ToDictionaryAsync(x => x.Key, x => x.Display);
return ret.ToList();
}
@@ -107,6 +137,9 @@ namespace AyaNova.Biz
//Get the keys for a list of keys provided, static format for calling from other internal classes
internal static async Task>> GetSubsetStatic(AyaNova.Api.Controllers.LocaleController.LocaleSubsetParam param)
{
+#if (DEBUG)
+ TrackRequestedKey(param.Keys);
+#endif
AyContext ct = ServiceProviderProvider.DBContext;
if (!LocaleExistsStatic(param.LocaleId, ct))
param.LocaleId = ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID;
@@ -124,6 +157,9 @@ namespace AyaNova.Biz
{
if (string.IsNullOrWhiteSpace(key))
return "ERROR: GetDefaultLocalizedText NO KEY VALUE SPECIFIED";
+#if (DEBUG)
+ TrackRequestedKey(key);
+#endif
AyContext ct = ServiceProviderProvider.DBContext;
return await ct.LocaleItem.Where(m => m.LocaleId == ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID && m.Key == key).Select(m => m.Display).FirstOrDefaultAsync();
}
@@ -439,9 +475,11 @@ namespace AyaNova.Biz
}
//Now add keys that were added after v7 for RAVEN using default locale values
- foreach(string s in ValidKeys){
- if(!NewLocaleDict.ContainsKey(s)){
- NewLocaleDict.Add(s,GetDefaultLocalizedText(s).Result);
+ foreach (string s in ValidKeys)
+ {
+ if (!NewLocaleDict.ContainsKey(s))
+ {
+ NewLocaleDict.Add(s, GetDefaultLocalizedText(s).Result);
}
}
diff --git a/server/AyaNova/util/ServerBootConfig.cs b/server/AyaNova/util/ServerBootConfig.cs
index e5f48bce..bc1da3d1 100644
--- a/server/AyaNova/util/ServerBootConfig.cs
+++ b/server/AyaNova/util/ServerBootConfig.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using Microsoft.Extensions.Configuration;
@@ -11,6 +12,14 @@ namespace AyaNova.Util
internal static class ServerBootConfig
{
+
+ //Diagnostic static values used during development, may not be related to config at all, this is just a convenient class to put them in
+#if (DEBUG)
+ internal static List LocaleKeysRequested { get; set; }
+
+#endif
+
+
//CONTENTROOTPATH
internal static string AYANOVA_CONTENT_ROOT_PATH { get; set; } //Note: set in startup.cs, not in program.cs as it requires startup IHostingEnvironment
@@ -55,6 +64,11 @@ namespace AyaNova.Util
///
internal static void SetConfiguration(IConfigurationRoot config)
{
+
+#if (DEBUG)
+ LocaleKeysRequested = new List();
+#endif
+
bool? bTemp = null;
#region SERVER BASICS