Permalink
Browse files

Added missing files

  • Loading branch information...
1 parent 68050ee commit 22cae2f49e91d1c2b64d9e9adf332b9aaf196d15 @jchannon jchannon committed Dec 20, 2012
@@ -0,0 +1,56 @@
+
+using System.Collections;
+using System.Collections.Generic;
+
+namespace Nancy.ViewEngines.Razor
+{
+ using System;
+ using Nancy.Culture;
+ using System.Globalization;
+
+ public class DefaultLocationlisation : ILocationlisation
+ {
+ private readonly IDictionary<string, string> dictionary;
+
+ public DefaultLocationlisation()
+ : this(new Dictionary<string, string>(0))
+ {
+ this.dictionary.Add("Greeting-en-GB", "Hello sir");
+ this.dictionary.Add("Greeting-de-DE", "Guten Tag");
+ this.dictionary.Add("Greeting", "Howdy");
+ }
+
+ public DefaultLocationlisation(IDictionary<string, string> dictionary)
+ {
+ this.dictionary = dictionary;
+ }
+
+ public string this[string key]
+ {
+ get
+ {
+ if (dictionary.ContainsKey(key + "-" + CurrentCulture))
+ {
+ return dictionary[key + "-" + CurrentCulture];
+ }
+ else
+ {
+ return dictionary.ContainsKey(key) ? dictionary[key] : null;
+ }
+ }
+ set { dictionary[key] = value; }
+ }
+
+ public CultureInfo CurrentCulture { get; set; }
+
+ public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
+ {
+ return dictionary.GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this.GetEnumerator();
+ }
+ }
+}
@@ -0,0 +1,12 @@
+using System.Collections.Generic;
+
+namespace Nancy.ViewEngines.Razor
+{
+ using System.Globalization;
+
+ public interface ILocationlisation : IEnumerable<KeyValuePair<string, string>>
+ {
+ string this[string key] { get; set; }
+ CultureInfo CurrentCulture { get; set; }
+ }
+}

0 comments on commit 22cae2f

Please sign in to comment.