Skip to content

Commit

Permalink
Fix loading locale from POEditor web API
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj committed Apr 6, 2024
1 parent 3ef3cd3 commit 109490e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Localization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinDynamicDesktop
Expand Down Expand Up @@ -61,7 +60,7 @@ public static void Initialize()
}
else
{
LoadLocaleFromWeb().Wait();
LoadLocaleFromWeb();
}

if (JsonConfig.firstRun)
Expand Down Expand Up @@ -146,7 +145,7 @@ public static void NotifyIfTestMode()
}
}

private static async Task LoadLocaleFromWeb()
private static void LoadLocaleFromWeb()
{
var client = new RestClient("https://api.poeditor.com");

Expand All @@ -156,15 +155,15 @@ private static async Task LoadLocaleFromWeb()
request.AddParameter("language", currentLocale);
request.AddParameter("type", "mo");

var response = await client.ExecuteAsync<PoEditorApiData>(request);
var response = client.Execute<PoEditorApiData>(request);
if (!response.IsSuccessful)
{
return;
}

using (HttpClient httpClient = new HttpClient())
{
byte[] moBinary = await httpClient.GetByteArrayAsync(response.Data.result.url);
byte[] moBinary = httpClient.GetByteArrayAsync(response.Data.result.url).Result;

using (Stream stream = new MemoryStream(moBinary))
{
Expand Down

0 comments on commit 109490e

Please sign in to comment.