forked from ArduPilot/MissionPlanner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Localizations: let FW change to ConfigLang
- Loading branch information
Showing
5 changed files
with
70 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using MissionPlanner.Utilities; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace MissionPlanner | ||
{ | ||
public static class Localizations | ||
{ | ||
public static CultureInfo ConfigLang = CultureInfo.GetCultureInfo("en-US"); | ||
|
||
public static CultureInfo GetConfigLang() | ||
{ | ||
CultureInfo ci = CultureInfoEx.GetCultureInfo((string)MainV2.config["language"]); | ||
if (ci != null) | ||
{ | ||
return ci; | ||
} | ||
else | ||
{ | ||
return CultureInfo.GetCultureInfo("en-US"); | ||
} | ||
} | ||
|
||
public static string ReplaceMirrorUrl(ref string url) | ||
{ | ||
switch (ConfigLang.Name) | ||
{ | ||
case "zh-CN": | ||
case "zh-Hans": | ||
if (url.Contains("raw.github.com")) | ||
{ | ||
url = url.Replace("raw.github.com", "githubraw.diywrj.com"); | ||
} | ||
else if (url.Contains("firmware.diydrones.com")) | ||
{ | ||
url = url.Replace("firmware.diydrones.com", "firmware.diywrj.com"); | ||
} | ||
else if (url.Contains("github.com")) | ||
{ | ||
url = url.Replace("github.com", "github.diywrj.com"); | ||
} | ||
else | ||
{ | ||
} | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return url; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters