changeset 110:a5714f82073d

* Add method for upper-casing just first character (based on DotNetPerls assertion that it is quicker this way) * Make sure languages capitalise (Benoit spotted Microsoft don't capitalise their French language French)
author IBBoard <dev@ibboard.co.uk>
date Fri, 20 Jan 2012 20:50:25 +0000
parents 93081f4df6b8
children 9832caa89140
files Lang/StringManipulation.cs Lang/TranslationLanguage.cs
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Lang/StringManipulation.cs	Sat Sep 24 11:57:54 2011 +0100
+++ b/Lang/StringManipulation.cs	Fri Jan 20 20:50:25 2012 +0000
@@ -61,6 +61,18 @@
 				int halfLength = strLength / 2;
 				return stringToShorten.Substring(0, halfLength - diff)+"..."+stringToShorten.Substring(halfLength + diff);
 			}
+		}
+
+		public static string UpperFirst(string toUpper)
+		{
+			if (string.IsNullOrEmpty(toUpper))
+			{
+				return string.Empty;
+			}
+
+			char[] chars = toUpper.ToCharArray();
+			chars[0] = char.ToUpper(chars[0]);
+			return new string(chars);
 		}
 	}
 }
--- a/Lang/TranslationLanguage.cs	Sat Sep 24 11:57:54 2011 +0100
+++ b/Lang/TranslationLanguage.cs	Fri Jan 20 20:50:25 2012 +0000
@@ -43,7 +43,7 @@
 			try
 			{
 				CultureInfo culture = CultureInfo.GetCultureInfo(langCode);
-				langName = culture.NativeName;
+				langName = StringManipulation.UpperFirst(culture.NativeName);
 			}
 			catch (ArgumentException)
 			{