Skip to content

Commit

Permalink
Added easier locale to get languages
Browse files Browse the repository at this point in the history
  • Loading branch information
mathijs-bb committed Sep 30, 2024
1 parent 723d517 commit d8e935e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Apps.Wordpress.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apps.Wordpress", "Apps.Wordpress\Apps.Wordpress.csproj", "{B82808E9-A1BE-422D-ADC0-CA45DF019546}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{475A3241-19CF-4CCB-A95E-FFD1E4960965}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{B82808E9-A1BE-422D-ADC0-CA45DF019546}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B82808E9-A1BE-422D-ADC0-CA45DF019546}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B82808E9-A1BE-422D-ADC0-CA45DF019546}.Release|Any CPU.Build.0 = Release|Any CPU
{475A3241-19CF-4CCB-A95E-FFD1E4960965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{475A3241-19CF-4CCB-A95E-FFD1E4960965}.Debug|Any CPU.Build.0 = Debug|Any CPU
{475A3241-19CF-4CCB-A95E-FFD1E4960965}.Release|Any CPU.ActiveCfg = Release|Any CPU
{475A3241-19CF-4CCB-A95E-FFD1E4960965}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 2 additions & 0 deletions Apps.Wordpress/Actions/PolylangActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public async Task<LanguagesResponse> GetLanguages()
return new()
{
Languages = result,
DefaultLanguageCode = result.FirstOrDefault(x => x.IsDefault)?.Locale,
OtherLanguageCodes = result.Select(x => x.Locale),
};
}
}
2 changes: 1 addition & 1 deletion Apps.Wordpress/Apps.Wordpress.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Product>Wordpress (+ Polylang)</Product>
<Version>1.2.2</Version>
<Version>1.2.3</Version>
<Description>The world’s most popular website builder</Description>
<AssemblyName>Apps.Wordpress</AssemblyName>
</PropertyGroup>
Expand Down
10 changes: 9 additions & 1 deletion Apps.Wordpress/Models/Polylang/LanguagesResponse.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
namespace Apps.Wordpress.Models.Polylang;
using Blackbird.Applications.Sdk.Common;

namespace Apps.Wordpress.Models.Polylang;

public class LanguagesResponse
{
public IEnumerable<Language> Languages { get; set;}

[Display("Default locale")]
public string? DefaultLanguageCode { get; set;}

[Display("Other locales")]
public IEnumerable<string> OtherLanguageCodes { get; set;}
}

0 comments on commit d8e935e

Please sign in to comment.