summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
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))