* Retrieve only ISO codes from the database rather than full language objects if that's all we need. * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Removed repository updates and migrated the new service method to an extension method. * Fixed issue after merge. * Removed left-over using --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
17 lines
602 B
C#
17 lines
602 B
C#
using Umbraco.Cms.Core.Services;
|
|
|
|
namespace Umbraco.Cms.Core.Extensions;
|
|
|
|
/// <summary>
|
|
/// Provides extension methods for <see cref="ILanguageService"/>.
|
|
/// </summary>
|
|
public static class LanguageServiceExtensions
|
|
{
|
|
/// <summary>
|
|
/// Retrieves all ISO codes of all languages.
|
|
/// </summary>
|
|
/// <param name="service">The <see cref="ILanguageService"/>.</param>
|
|
/// <returns>A collection of language ISO codes.</returns>
|
|
public static async Task<IEnumerable<string>> GetAllIsoCodesAsync(this ILanguageService service) => (await service.GetAllAsync()).Select(x => x.IsoCode);
|
|
}
|