linuxgurugamer / ksp_toolbar

Common API for GUI toolbars in KSP
BSD 2-Clause "Simplified" License
13 stars 14 forks source link

Support Localization #1

Closed RonnyWu closed 6 years ago

RonnyWu commented 6 years ago

https://forum.kerbalspaceprogram.com toolbar CN_Warren

I tried to do localized support and Chinese translation, but I do not have the runtime environment verification, so please verify.

RonnyWu commented 6 years ago
//////////////////////////////////////////////////
////////// Localization process record start
//////////////////////////////////////////////////
//
// Extracted from (GUI/AbstractWindow.cs) 0 items matches
// Extracted from (GUI/ConfirmDialog.cs) 2 items matches , 2 new items
// #TOOLBAR_UI_OK = "OK"
// #TOOLBAR_UI_CANCEL = "Cancel"
// Extracted from (GUI/CursorGrabbing.cs) 0 items matches
// Extracted from (GUI/DragEvent.cs) 0 items matches
// Extracted from (GUI/Draggable.cs) 0 items matches
// Extracted from (GUI/DragHandler.cs) 0 items matches
// Extracted from (GUI/DropMarker.cs) 0 items matches
// Extracted from (GUI/EditorLock.cs) 0 items matches
// Extracted from (GUI/IconPickerDialog.cs) 1 items matches , 0 new items
// Extracted from (GUI/IPopupMenuOption.cs) 0 items matches
// Extracted from (GUI/PopupMenu.cs) 0 items matches
// Extracted from (GUI/Rectangle.cs) 0 items matches
// Extracted from (GUI/Resizable.cs) 0 items matches
// Extracted from (GUI/Separator.cs) 0 items matches
// Extracted from (GUI/TextureMenuOption.cs) 0 items matches
// Extracted from (GUI/WindowList.cs) 0 items matches
// Extracted from (Toolbar/Button.cs) 0 items matches
// Extracted from (Toolbar/ClickEvent.cs) 0 items matches
// Extracted from (Toolbar/Command.cs) 0 items matches
// Extracted from (Toolbar/CommandCreationCounter.cs) 0 items matches
// Extracted from (Toolbar/DestroyEvent.cs) 0 items matches
// Extracted from (Toolbar/DestroyHandler.cs) 0 items matches
// Extracted from (Toolbar/FolderSettings.cs) 0 items matches
// Extracted from (Toolbar/FolderSettingsDialog.cs) 6 items matches , 4 new items
// #TOOLBAR_UI_FOLDER_SETTINGS = "Folder Settings"
// #TOOLBAR_UI_BUTTON_ICON = "Button icon:"
// #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= "Button tooltip text:"
// #TOOLBAR_UI_SELECT_ICON = "Select Icon"
// Extracted from (Toolbar/MouseEnterEvent.cs) 0 items matches
// Extracted from (Toolbar/MouseLeaveEvent.cs) 0 items matches
// Extracted from (Toolbar/MouseMoveEvent.cs) 0 items matches
// Extracted from (Toolbar/PopupMenuDrawable.cs) 0 items matches
// Extracted from (Toolbar/Toolbar.cs)  22 items items matches , 22 new items
// #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = "Configure Visible Buttons..."
// #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = "Unlock Position and Size"
// #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = "Lock Position and Size"
// #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = "Unlock Button Order"
// #TOOLBAR_UI_LOCK_BUTTON_ORDER = "Lock Button Order"
// #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = "Deactivate Auto-Hide at Screen Edge"
// #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = "Activate Auto-Hide at Screen Edge"
// #TOOLBAR_UI_HIDE_BORDER = "Hide Border"
// #TOOLBAR_UI_SHOW_BORDER = "Show Border"
// #TOOLBAR_UI_UNITY_SKIN = "Use Unity 'Smoke' Skin"
// #TOOLBAR_UI_KSP_SKIN = "Use KSP Skin"
// #TOOLBAR_UI_CREATE_NEW_FOLDER = "Create New Folder..."
// #TOOLBAR_UI_CREATE_NEW_TOOLBAR = "Create New Toolbar"
// #TOOLBAR_UI_DELETE_TOOLBAR = "Delete Toolbar..."
// #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = "Delete Toolbar"
// #TOOLBAR_UI_DELETE_TOOLBAR_HINT = "Delete this toolbar?"
// #TOOLBAR_UI_ABOUT = "About the Toolbar Plugin..."
// #TOOLBAR_UI_NEW_FOLDER = "New Folder"
// #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = "Edit Folder Settings"
// #TOOLBAR_UI_DELETE_FOLDER = "Delete Folder"
// #TOOLBAR_UI_DELETE_FOLDER_HINT = "Delete this folder? Buttons inside the folder will be moved to the main toolbar."
// Extracted from (Toolbar/ToolbarGameScene.cs) 0 items matches
// Extracted from (Toolbar/ToolbarManager.cs) 0 items matches
// Extracted from (Toolbar/VisibleButtons.cs) 0 items matches
// Extracted from (Toolbar/VisibleButtonsSelector.cs) 4 items matches , 4 new items
// #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = "Toolbar Button Visibility"
// #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = "Configure which buttons should be visible in the current game scene."
// #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = "Note: Plugins may still decide to hide buttons from any game scene even if those buttons are active here."
// #TOOLBAR_UI_CLOSE = "Close"
// Extracted from (Extensions.cs) 0 items matches
// Extracted from (FloatCurveXY.cs) 0 items matches
// Extracted from (InstallChecker.cs) ignore
// Extracted from (KSPAddonFixed.cs) 0 items matches
// Extracted from (Log.cs) 0 items matches
// Extracted from (Utils.cs) 0 items matches
//
//////////////////////////////////////////////////
////////// Localization process record end
//////////////////////////////////////////////////

Localization{

    en-us
    {
        #TOOLBAR_UI_OK = "OK"
        #TOOLBAR_UI_CANCEL = "Cancel"
        #TOOLBAR_UI_FOLDER_SETTINGS = "Folder Settings"
        #TOOLBAR_UI_BUTTON_ICON = "Button icon:"
        #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= "Button tooltip text:"
        #TOOLBAR_UI_SELECT_ICON = "Select Icon"
        #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = "Configure Visible Buttons..."
        #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = "Unlock Position and Size"
        #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = "Lock Position and Size"
        #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = "Unlock Button Order"
        #TOOLBAR_UI_LOCK_BUTTON_ORDER = "Lock Button Order"
        #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = "Deactivate Auto-Hide at Screen Edge"
        #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = "Activate Auto-Hide at Screen Edge"
        #TOOLBAR_UI_HIDE_BORDER = "Hide Border"
        #TOOLBAR_UI_SHOW_BORDER = "Show Border"
        #TOOLBAR_UI_UNITY_SKIN = "Use Unity 'Smoke' Skin"
        #TOOLBAR_UI_KSP_SKIN = "Use KSP Skin"
        #TOOLBAR_UI_CREATE_NEW_FOLDER = "Create New Folder..."
        #TOOLBAR_UI_CREATE_NEW_TOOLBAR = "Create New Toolbar"
        #TOOLBAR_UI_DELETE_TOOLBAR = "Delete Toolbar..."
        #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = "Delete Toolbar"
        #TOOLBAR_UI_DELETE_TOOLBAR_HINT = "Delete this toolbar?"
        #TOOLBAR_UI_ABOUT = "About the Toolbar Plugin..."
        #TOOLBAR_UI_NEW_FOLDER = "New Folder"
        #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = "Edit Folder Settings"
        #TOOLBAR_UI_DELETE_FOLDER = "Delete Folder"
        #TOOLBAR_UI_DELETE_FOLDER_HINT = "Delete this folder? Buttons inside the folder will be moved to the main toolbar."
        #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = "Toolbar Button Visibility"
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = "Configure which buttons should be visible in the current game scene."
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = "Note: Plugins may still decide to hide buttons from any game scene even if those buttons are active here."
        #TOOLBAR_UI_CLOSE = "Close"
    }

    zh-cn
    {
        #TOOLBAR_UI_OK = "确定"
        #TOOLBAR_UI_CANCEL = "取消"
        #TOOLBAR_UI_FOLDER_SETTINGS = "文件夹设置"
        #TOOLBAR_UI_BUTTON_ICON = "按钮图标:"
        #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= "按钮提示文本:"
        #TOOLBAR_UI_SELECT_ICON = "选择图标"
        #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = "配置可见按钮..."
        #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = "解除位置和大小锁定"
        #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = "开启位置和大小锁定"
        #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = "解除按钮顺序锁定"
        #TOOLBAR_UI_LOCK_BUTTON_ORDER = "开启按钮顺序锁定"
        #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = "禁用贴边自动隐藏"
        #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = "启用贴边自动隐藏"
        #TOOLBAR_UI_HIDE_BORDER = "隐藏边框"
        #TOOLBAR_UI_SHOW_BORDER = "显示边框"
        #TOOLBAR_UI_UNITY_SKIN = "使用 Unity 'Smoke' 皮肤"
        #TOOLBAR_UI_KSP_SKIN = "使用 KSP 皮肤"
        #TOOLBAR_UI_CREATE_NEW_FOLDER = "新建文件夹..."
        #TOOLBAR_UI_CREATE_NEW_TOOLBAR = "新建工具栏"
        #TOOLBAR_UI_DELETE_TOOLBAR = "删除工具栏..."
        #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = "删除工具栏"
        #TOOLBAR_UI_DELETE_TOOLBAR_HINT = "删除当前工具栏?"
        #TOOLBAR_UI_ABOUT = "关于工具栏插件..."
        #TOOLBAR_UI_NEW_FOLDER = "新建文件夹"
        #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = "修改文件夹设置"
        #TOOLBAR_UI_DELETE_FOLDER = "删除文件夹"
        #TOOLBAR_UI_DELETE_FOLDER_HINT = "是否删除当前文件夹? 文件夹内的按钮将被移动到主工具栏."
        #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = "工具栏按钮可见性"
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = "配置当前游戏场景中应该显示哪些按钮."
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = "注意:虽然这些按钮在这里显示,但是插件依然可以决定隐藏游戏中的按钮."
        #TOOLBAR_UI_CLOSE = "关闭"
    }

    // Requires Spanish translation
    // Requiere traducción al español

    es-es
    {
        #TOOLBAR_UI_OK = "OK"
        #TOOLBAR_UI_CANCEL = "Cancel"
        #TOOLBAR_UI_FOLDER_SETTINGS = "Folder Settings"
        #TOOLBAR_UI_BUTTON_ICON = "Button icon:"
        #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= "Button tooltip text:"
        #TOOLBAR_UI_SELECT_ICON = "Select Icon"
        #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = "Configure Visible Buttons..."
        #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = "Unlock Position and Size"
        #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = "Lock Position and Size"
        #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = "Unlock Button Order"
        #TOOLBAR_UI_LOCK_BUTTON_ORDER = "Lock Button Order"
        #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = "Deactivate Auto-Hide at Screen Edge"
        #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = "Activate Auto-Hide at Screen Edge"
        #TOOLBAR_UI_HIDE_BORDER = "Hide Border"
        #TOOLBAR_UI_SHOW_BORDER = "Show Border"
        #TOOLBAR_UI_UNITY_SKIN = "Use Unity 'Smoke' Skin"
        #TOOLBAR_UI_KSP_SKIN = "Use KSP Skin"
        #TOOLBAR_UI_CREATE_NEW_FOLDER = "Create New Folder..."
        #TOOLBAR_UI_CREATE_NEW_TOOLBAR = "Create New Toolbar"
        #TOOLBAR_UI_DELETE_TOOLBAR = "Delete Toolbar..."
        #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = "Delete Toolbar"
        #TOOLBAR_UI_DELETE_TOOLBAR_HINT = "Delete this toolbar?"
        #TOOLBAR_UI_ABOUT = "About the Toolbar Plugin..."
        #TOOLBAR_UI_NEW_FOLDER = "New Folder"
        #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = "Edit Folder Settings"
        #TOOLBAR_UI_DELETE_FOLDER = "Delete Folder"
        #TOOLBAR_UI_DELETE_FOLDER_HINT = "Delete this folder? Buttons inside the folder will be moved to the main toolbar."
        #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = "Toolbar Button Visibility"
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = "Configure which buttons should be visible in the current game scene."
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = "Note: Plugins may still decide to hide buttons from any game scene even if those buttons are active here."
        #TOOLBAR_UI_CLOSE = "Close"
    }

    // Requires Japanese translation
    // 日本語の翻訳が必要

    jp
    {
        #TOOLBAR_UI_OK = "OK"
        #TOOLBAR_UI_CANCEL = "Cancel"
        #TOOLBAR_UI_FOLDER_SETTINGS = "Folder Settings"
        #TOOLBAR_UI_BUTTON_ICON = "Button icon:"
        #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= "Button tooltip text:"
        #TOOLBAR_UI_SELECT_ICON = "Select Icon"
        #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = "Configure Visible Buttons..."
        #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = "Unlock Position and Size"
        #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = "Lock Position and Size"
        #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = "Unlock Button Order"
        #TOOLBAR_UI_LOCK_BUTTON_ORDER = "Lock Button Order"
        #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = "Deactivate Auto-Hide at Screen Edge"
        #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = "Activate Auto-Hide at Screen Edge"
        #TOOLBAR_UI_HIDE_BORDER = "Hide Border"
        #TOOLBAR_UI_SHOW_BORDER = "Show Border"
        #TOOLBAR_UI_UNITY_SKIN = "Use Unity 'Smoke' Skin"
        #TOOLBAR_UI_KSP_SKIN = "Use KSP Skin"
        #TOOLBAR_UI_CREATE_NEW_FOLDER = "Create New Folder..."
        #TOOLBAR_UI_CREATE_NEW_TOOLBAR = "Create New Toolbar"
        #TOOLBAR_UI_DELETE_TOOLBAR = "Delete Toolbar..."
        #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = "Delete Toolbar"
        #TOOLBAR_UI_DELETE_TOOLBAR_HINT = "Delete this toolbar?"
        #TOOLBAR_UI_ABOUT = "About the Toolbar Plugin..."
        #TOOLBAR_UI_NEW_FOLDER = "New Folder"
        #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = "Edit Folder Settings"
        #TOOLBAR_UI_DELETE_FOLDER = "Delete Folder"
        #TOOLBAR_UI_DELETE_FOLDER_HINT = "Delete this folder? Buttons inside the folder will be moved to the main toolbar."
        #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = "Toolbar Button Visibility"
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = "Configure which buttons should be visible in the current game scene."
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = "Note: Plugins may still decide to hide buttons from any game scene even if those buttons are active here."
        #TOOLBAR_UI_CLOSE = "Close"
    }

    // Requires Russian translation
    // Нужен перевод на русский язык

    ru
    {
        #TOOLBAR_UI_OK = "OK"
        #TOOLBAR_UI_CANCEL = "Cancel"
        #TOOLBAR_UI_FOLDER_SETTINGS = "Folder Settings"
        #TOOLBAR_UI_BUTTON_ICON = "Button icon:"
        #TOOLBAR_UI_BUTTON_TOOLTIP_TEXT= "Button tooltip text:"
        #TOOLBAR_UI_SELECT_ICON = "Select Icon"
        #TOOLBAR_UI_CONFIGURE_VISIBLE_BUTTONS = "Configure Visible Buttons..."
        #TOOLBAR_UI_UNLOCK_POSITION_AND_SIZE = "Unlock Position and Size"
        #TOOLBAR_UI_LOCK_POSITION_AND_SIZE = "Lock Position and Size"
        #TOOLBAR_UI_UNLOCK_BUTTON_ORDER = "Unlock Button Order"
        #TOOLBAR_UI_LOCK_BUTTON_ORDER = "Lock Button Order"
        #TOOLBAR_UI_DEACTIVATE_AUTO_HIDE = "Deactivate Auto-Hide at Screen Edge"
        #TOOLBAR_UI_ACTIVATE_AUTO_HIDE = "Activate Auto-Hide at Screen Edge"
        #TOOLBAR_UI_HIDE_BORDER = "Hide Border"
        #TOOLBAR_UI_SHOW_BORDER = "Show Border"
        #TOOLBAR_UI_UNITY_SKIN = "Use Unity 'Smoke' Skin"
        #TOOLBAR_UI_KSP_SKIN = "Use KSP Skin"
        #TOOLBAR_UI_CREATE_NEW_FOLDER = "Create New Folder..."
        #TOOLBAR_UI_CREATE_NEW_TOOLBAR = "Create New Toolbar"
        #TOOLBAR_UI_DELETE_TOOLBAR = "Delete Toolbar..."
        #TOOLBAR_UI_DELETE_TOOLBAR_TITLE = "Delete Toolbar"
        #TOOLBAR_UI_DELETE_TOOLBAR_HINT = "Delete this toolbar?"
        #TOOLBAR_UI_ABOUT = "About the Toolbar Plugin..."
        #TOOLBAR_UI_NEW_FOLDER = "New Folder"
        #TOOLBAR_UI_EDIT_FOLDER_SETTINGS = "Edit Folder Settings"
        #TOOLBAR_UI_DELETE_FOLDER = "Delete Folder"
        #TOOLBAR_UI_DELETE_FOLDER_HINT = "Delete this folder? Buttons inside the folder will be moved to the main toolbar."
        #TOOLBAR_UI_CONFIG_VISIBLE_TITLE = "Toolbar Button Visibility"
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON = "Configure which buttons should be visible in the current game scene."
        #TOOLBAR_UI_CONFIG_VISIBLE_BUTTON_NOTE = "Note: Plugins may still decide to hide buttons from any game scene even if those buttons are active here."
        #TOOLBAR_UI_CLOSE = "Close"
    }

}
linuxgurugamer commented 6 years ago

Thank you for doing this.

It looks like you might have used a program to extract the strings, if so, what is it?

I've been able to get it compiled, but there were some problems, Please see my comments below:

  1. Were you able to compile this at all? There were several compile-time errors I had to fix, including replacing constants in method defs with function calls (ie: ConfirmDialog, at least two places), and in the Toolbar.cs, where you seemed to have rewritten the deleteFolder() method, there was "eg : " in the middle of the line for the ConfirmDialog.confirm at line 1518

  2. One of the files was missing the using KSP.Localization;

  3. Can you please explain to me why you rewrote the deleteFolder() method in Toolbar/Internal/Toolbar/Toolbar.cs

  4. Also, for future stuff you might do, given the naming convention you are using, there was really no need to add the comments inline the code with the lines from the dictionary.cfg. It actually makes it harder for me to follow in the diff.

  5. I always review the diffs, especially from an unknown person (unknown to me, that is), so right now, I'm wading through them. All those extra comments are essentially useless, since the name of the localization replacement says exactly what it is.

RonnyWu commented 6 years ago

A1 : I modified the code, and there is no such tool software. A2 : "eg: "It is superfluous,Delete just fine. A3 : Because of the second, so there is no such problem A4: The extra comment is just for convenience, I will delete it.

Later, I will pull again.