Localization fixes

This commit is contained in:
Lubos Lenco
2020-06-11 12:37:21 +02:00
parent 804b3e239e
commit 4fcb19bff2
4 changed files with 22 additions and 15 deletions
+1 -1
View File
@@ -266,7 +266,7 @@ class History {
copyToUndo(Context.layer.id, undoI, isMask);
pushUndo = false;
push(UIToolbar.inst.toolNames[Context.tool]);
push(tr(UIToolbar.inst.toolNames[Context.tool]));
}
public static function newLayer() {
+19 -12
View File
@@ -57,30 +57,37 @@ class Translator {
// Generate extended font atlas
// Basic Latin + Latin-1 Supplement + Latin Extended-A
kha.graphics2.Graphics.fontGlyphs = [for (i in 32...383) i];
// + Cyrillic
for (i in 1024...1119) kha.graphics2.Graphics.fontGlyphs.push(i);
// Push additional char codes contained in translation file
var cjk = false;
for (s in translations) {
for (i in 0...s.length) {
if (kha.graphics2.Graphics.fontGlyphs.indexOf(s.charCodeAt(i)) == -1) {
// Assume cjk in the > 1119 range for now
if (s.charCodeAt(i) > 1119 && kha.graphics2.Graphics.fontGlyphs.indexOf(s.charCodeAt(i)) == -1) {
if (!cjk) {
kha.graphics2.Graphics.fontGlyphs = [for (i in 32...127) i];
cjk = true;
}
kha.graphics2.Graphics.fontGlyphs.push(s.charCodeAt(i));
// Assume cjk in the > 383 range for now
cjk = true;
}
}
}
if (cjk) {
// Load and assign font with cjk characters
iron.data.Data.getFont("font_cjk.ttf", function(f: kha.Font) {
App.font = f;
var uis = [App.uiBox, App.uiMenu, arm.ui.UISidebar.inst.ui, arm.ui.UINodes.inst.ui, arm.ui.UIView2D.inst.ui];
// Scale up the font size a bit
uis[0].t.FONT_SIZE = Std.int(uis[0].t.FONT_SIZE * 1.3);
for (ui in uis) {
ui.ops.font = f;
ui.setScale(ui.ops.scaleFactor);
}
iron.App.notifyOnInit(function() {
iron.data.Data.getFont("font_cjk.ttf", function(f: kha.Font) {
App.font = f;
var uis = [App.uiBox, App.uiMenu, arm.ui.UISidebar.inst.ui, arm.ui.UINodes.inst.ui, arm.ui.UIView2D.inst.ui];
// Scale up the font size a bit
uis[0].t.FONT_SIZE = Std.int(uis[0].t.FONT_SIZE * 1.4);
for (ui in uis) {
ui.ops.font = f;
ui.setScale(ui.ops.scaleFactor);
}
});
});
}
}
+1 -1
View File
@@ -62,7 +62,7 @@ class UIToolbar {
ui._x += 2;
if (Context.tool == i) ui.rect(-1, -1, 50 + 2, 50 + 2, ui.t.HIGHLIGHT_COL, 2);
if (ui.image(img, -1, null, i * imgw, 0, imgw, imgw) == State.Started) Context.selectTool(i);
if (ui.isHovered) ui.tooltip(toolNames[i] + " " + keys[i]);
if (ui.isHovered) ui.tooltip(tr(toolNames[i]) + " " + keys[i]);
ui._x -= 2;
ui._y += 2;
}