LanguageCode parameter added for DocumentAppService.GetResourceAsync

pull/1180/head
Yunus Emre Kalkan 6 years ago
parent 77fef984b8
commit 256e6ebce6

@ -72,12 +72,12 @@ namespace Volo.Docs.Documents
public async Task<DocumentResourceDto> GetResourceAsync(GetDocumentResourceInput input)
{
var project = await _projectRepository.GetAsync(input.ProjectId);
var cacheKey = $"Resource@{project.ShortName}#{input.Name}#{input.Version}";
var cacheKey = $"Resource@{project.ShortName}#{input.LanguageCode}#{input.Name}#{input.Version}";
async Task<DocumentResourceDto> GetResourceAsync()
{
var store = _documentStoreFactory.Create(project.DocumentStoreType);
var documentResource = await store.GetResource(project, input.Name, input.Version);
var documentResource = await store.GetResource(project, input.Name, input.LanguageCode, input.Version);
return ObjectMapper.Map<DocumentResource, DocumentResourceDto>(documentResource);
}

@ -12,7 +12,7 @@ namespace Volo.Docs.Documents
Task<List<VersionInfo>> GetVersionsAsync(Project project);
Task<DocumentResource> GetResource(Project project, string resourceName, string version);
Task<DocumentResource> GetResource(Project project, string resourceName, string languageCode, string version);
Task<LanguageConfig> GetLanguageListAsync(Project project, string version);
}

@ -55,7 +55,7 @@ namespace Volo.Docs.FileSystem.Documents
return JsonConvert.DeserializeObject<LanguageConfig>(configAsJson);
}
public async Task<DocumentResource> GetResource(Project project, string resourceName, string version)
public async Task<DocumentResource> GetResource(Project project, string resourceName, string languageCode, string version)
{
var projectFolder = project.GetFileSystemPath();
var path = Path.Combine(projectFolder, resourceName);

@ -91,9 +91,9 @@ namespace Volo.Docs.GitHub.Documents
return versions;
}
public async Task<DocumentResource> GetResource(Project project, string resourceName, string version)
public async Task<DocumentResource> GetResource(Project project, string resourceName, string languageCode, string version)
{
var rawRootUrl = CalculateRawRootUrl(project.GetGitHubUrl(version));
var rawRootUrl = CalculateRawRootUrlWithLanguageCode(project.GetGitHubUrl(version), languageCode);
var content = await DownloadWebContentAsByteArrayAsync(
rawRootUrl + resourceName,
project.GetGitHubAccessTokenOrNull(),

Loading…
Cancel
Save