Beispiel #1
0
        static string[] ResolveAvailableLanguages()
        {
            var contentPath = Path.Combine(TranslationLoader.GetEntryAssemblyDirectory(), ".tnt-content");

            return
                (Directory.EnumerateFiles(contentPath, "*.tnt")
                 .Select(Path.GetFileNameWithoutExtension)
                 .ToArray());
        }
Beispiel #2
0
        public static string t(this string original, string languageTag)
        {
            lock (Section)
            {
                if (SpecificTranslations.TryGetValue(languageTag, out var translation))
                {
                    return(translation.TryGetValue(original, out var translated)
                        ? translated
                        : original);
                }

                // no merging of languages supported for now.
                SpecificTranslations.Add(
                    languageTag,
                    TranslationLoader.LoadTranslation(new[] { languageTag }));

                return(t(original, languageTag));
            }
        }