Skip to content

Commit

Permalink
Added /user/languages/ as a valid directory
Browse files Browse the repository at this point in the history
Closes #10
  • Loading branch information
Trevor Payne committed Mar 11, 2021
1 parent 5fdb3a1 commit 153782c
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions epi-utilities-i18n/I18nUtility.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
Expand All @@ -15,7 +16,8 @@ namespace PepperDash.Utilities
{
public class I18NUtility : EssentialsBridgeableDevice, ILanguageProvider
{
private const string FileDirectory = @"\user\";
private const string FileDirectoryA = @"\user\";
private const string FileDirectoryB = @"\user\languages\";
private const string FileName = @"*languages*.json";

private readonly I18NUtilityConfiguration _config;
Expand All @@ -29,6 +31,7 @@ public class I18NUtility : EssentialsBridgeableDevice, ILanguageProvider
public I18NUtility(string key, string name, I18NUtilityConfiguration config)
: base(key, name)
{

_config = config;

CurrentLanguageFeedback = new StringFeedback(() => CurrentLanguageString);
Expand Down Expand Up @@ -88,10 +91,10 @@ public int CurrentLanguageIndex
}
}

private IEnumerable<string> FindLanguagesConfigurationFiles()
{
var files = Directory.GetFiles(FileDirectory, FileName);

private IEnumerable<string> FindLanguagesConfigurationFiles()
{
var files = Directory.GetFiles(FileDirectoryB, FileName) ?? Directory.GetFiles(FileDirectoryA, FileName);

if (files.Length != 0)
{
return files;
Expand Down

0 comments on commit 153782c

Please sign in to comment.