Languages - NKS0046
Use CultureManager.UpdateCulture
This analyzer provides the following strings:
Error List
Caller uses CultureInfo.CurrentUICulture
instead of CultureManager.UpdateCulture()
Suggestion Box
Use CultureManager.UpdateCulture()
instead of setting CultureInfo.CurrentUICulture
Description
CultureManager.UpdateCulture()
sets a current culture without affecting the host system. It also updates the settings so that it holds the new culture.
Extended Description
This code analyzer detects the usage of CurrentUICulture
from the CultureInfo
class found in the System.Globalizaiton
namespace.
The CultureInfo.CurrentUICulture
property gives you your current UI culture for your applications. However, Nitrocid is not a GUI application, so we've decided to make our own culture handler that respects your kernel settings.
It's advisable to use the CultureManager.UpdateCulture()
function so that your mod can load a new culture and save the kernel settings to make this change permanent across reboots.
Analysis Comparison
To get a brief insight about how this analyzer works, compare the two code blocks shown to you below:
Before the fix
After the fix
Suppression
You can suppress this suggestion by including it in the appropriate place, whichever is convenient.
For more information about how to suppress any warning issued by the Nitrocid analyzer, visit the below page:
Recommendation
We recommend that every caller which use this function use the recommended abovementioned method.
Last updated