예제 #1
0
        public async Task <IReadOnlyList <string> > GetSupportedLanguages()
        {
            try
            {
                var i18nSheet = await _i18nLocalStore.GetSheet(_i18nOptions.SpreadsheetId, "Global");

                return(i18nSheet == null?Array.Empty <string>() : i18nSheet.GetSupportedLanguages());
            }
            catch (I18nException e)
            {
                _logger.LogError(e, "Bad sheet format.");
                return(Array.Empty <string>());
            }
        }
        public async Task <I18nSheet> GetSheet(string spreadsheetId, string sheetName)
        {
            var cacheKey = GetCacheKey(spreadsheetId, sheetName);

            Task <I18nSheet> AddItem(string key)
            {
                return(_i18nLocalStore.GetSheet(spreadsheetId, sheetName));
            }

            return(await _i18nCache.GetOrAdd(cacheKey, AddItem));
        }