Beispiel #1
0
        private string FindFile(string language, string @namespace)
        {
            var path = Path.Combine(_basePath, language, @namespace + ".xml");

            if (File.Exists(path))
            {
                return(path);
            }

            path = Path.Combine(_basePath, BackendUtilities.GetLanguagePart(language), @namespace + ".xml");

            return(!File.Exists(path) ? null : path);
        }
        public Task <ITranslationTree> LoadNamespaceAsync(string language, string @namespace)
        {
            var treeKey = language + "_" + @namespace;

            if (_namespaces.TryGetValue(treeKey, out var tree))
            {
                return(Task.FromResult(tree as ITranslationTree));
            }

            treeKey = BackendUtilities.GetLanguagePart(language) + "_" + @namespace;

            if (!_namespaces.TryGetValue(treeKey, out tree))
            {
                return(Task.FromResult(default(ITranslationTree)));
            }

            return(Task.FromResult(tree as ITranslationTree));
        }