summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-23 18:24:15 +0100
committerGitHub <noreply@github.com>2020-01-23 18:24:15 +0100
commitcadf946863809fac2429eab1787d2f67bafcc173 (patch)
treedb79085713935fb37a502d9b441e2095905de341 /modules
parent1c0995d4509acd0a750f32517b14c01842220cca (diff)
parent59ec19d5a88a9a0f28222887e8f3584aaabb03bc (diff)
Merge pull request #35478 from neikeq/issue-32260
Mono/C#: Add setting to include I18N assemblies in the exported game
Diffstat (limited to 'modules')
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
index 96cafba87f..3e2a8c22a9 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
@@ -17,6 +17,43 @@ namespace GodotTools.Export
{
public class ExportPlugin : EditorExportPlugin
{
+ [Flags]
+ enum I18NCodesets
+ {
+ None = 0,
+ CJK = 1,
+ MidEast = 2,
+ Other = 4,
+ Rare = 8,
+ West = 16,
+ All = CJK | MidEast | Other | Rare | West
+ }
+
+ private void AddI18NAssemblies(Godot.Collections.Dictionary<string, string> assemblies, string platform)
+ {
+ var codesets = (I18NCodesets) ProjectSettings.GetSetting("mono/export/i18n_codesets");
+
+ if (codesets == I18NCodesets.None)
+ return;
+
+ string bclDir = DeterminePlatformBclDir(platform) ?? typeof(object).Assembly.Location.GetBaseDir();
+
+ void AddI18NAssembly(string name) => assemblies.Add(name, Path.Combine(bclDir, $"{name}.dll"));
+
+ AddI18NAssembly("I18N");
+
+ if ((codesets & I18NCodesets.CJK) != 0)
+ AddI18NAssembly("I18N.CJK");
+ if ((codesets & I18NCodesets.MidEast) != 0)
+ AddI18NAssembly("I18N.MidEast");
+ if ((codesets & I18NCodesets.Other) != 0)
+ AddI18NAssembly("I18N.Other");
+ if ((codesets & I18NCodesets.Rare) != 0)
+ AddI18NAssembly("I18N.Rare");
+ if ((codesets & I18NCodesets.West) != 0)
+ AddI18NAssembly("I18N.West");
+ }
+
public void RegisterExportSettings()
{
// TODO: These would be better as export preset options, but that doesn't seem to be supported yet
@@ -24,6 +61,16 @@ namespace GodotTools.Export
GlobalDef("mono/export/include_scripts_content", false);
GlobalDef("mono/export/export_assemblies_inside_pck", true);
+ GlobalDef("mono/export/i18n_codesets", I18NCodesets.All);
+
+ ProjectSettings.AddPropertyInfo(new Godot.Collections.Dictionary
+ {
+ ["type"] = Variant.Type.Int,
+ ["name"] = "mono/export/i18n_codesets",
+ ["hint"] = PropertyHint.Flags,
+ ["hint_string"] = "CJK,MidEast,Other,Rare,West"
+ });
+
GlobalDef("mono/export/aot/enabled", false);
GlobalDef("mono/export/aot/full_aot", false);
@@ -145,6 +192,8 @@ namespace GodotTools.Export
var initialDependencies = dependencies.Duplicate();
internal_GetExportedAssemblyDependencies(initialDependencies, buildConfig, DeterminePlatformBclDir(platform), dependencies);
+ AddI18NAssemblies(dependencies, platform);
+
string outputDataDir = null;
if (PlatformHasTemplateDir(platform))