# -*- coding: utf-8 -*-
#@+leo-ver=4-thin
#@+node:ekr.20040828105233:@thin examples/chinese_menu.py
#@@first
#@@language python
#@@tabwidth -4
"""
Translate a few menu items into Simplified Chinese
Leo
By Zhang Le <ejoy@xinhuanet.com>
"""
# Chinese translation completed by Zhang Le, May 2004
# based on the french_fm.py
# NOTE: The accelerated key (&) failed to work on Chinese text, probably because
# the width of one Chinese character is 2 not 1, which confuses Tk. I'm not sure
# whether this is a bug of Tk or a bug of Leo. Although I do not use & in the
# Chinese menu, Tk places an underline below the first character of each menu
# entry. Another bug in Tk?
# Note 2 (EKR): The menu names themselves did not translate on my XP machine.
# All the headlines appear as "??".
import leo.core.leoPlugins as leoPlugins
import leo.core.leoGlobals as g
#@+others
#@+node:ekr.20040828105233.1:onMenu
def onMenu (tag,keywords):
c = keywords.get("c")
table = (
#@ @+others
#@+node:ekr.20040828105233.2:file menu
("File","File"),
("New",""),
("Open...",""),
("Open With...","..."),
("Close",""),
("Save",""),
("Save As","..."),
("Save To","..."),
("Revert To Saved",""),
("Recent Files...","..."),
("Clear Recent Files",""),
("Read/Write...", "/..."),
("Read Outline Only", ""),
("Read @file Nodes", " @file "),
("Write Dirty @file Nodes", " @file "),
("Write missing @file Nodes", "(missing) @file "),
("Write Outline Only", ""),
("Write @file Nodes", " @file "),
("Write 4.x Derived Files", " 4.x "),
("Write 3.x Derived Files", " 3.x "),
("Tangle...", "Tangle ..."),
("Tangle All", " Tangle"),
("Tangle Marked", " Tangle "),
("Tangle", "Tangle "),
("Untangle...", "Untangle ..."),
("Untangle All", " Untangle"),
("Untangle Marked", " Untangle "),
("Untangle", "Untangle "),
("Import...", "..."),
("Import Derived File", ""),
("Import To @file", " @file"),
("Import To @root", " @root"),
("Import CWEB Files", " CWEB "),
("Import noweb Files", " noweb "),
("Import Flattened Outline", " (Flattened) (MORE )"),
("Export...", "..."),
("Export Headlines", " (Headlines)"),
("Outline To CWEB", " CWEB"),
("Outline To Noweb", " Noweb"),
("Flatten Outline", " (Flattened) (MORE )"),
("Remove Sentinels", " (Sentinelles)"),
("Weave", " Weave (Listing)"),
("Export all to AsciiDoc", " AsciiDoc "),
("Export current tree to AsciiDoc", " AsciiDoc "),
("Exit",""),
#@-node:ekr.20040828105233.2:file menu
#@+node:ekr.20040828105233.3:edit menu
("Edit","Edit"),
("Undo Typing",""),
("Undo Cut Node",""),
("Redo Typing",""),
("Can't Undo", ""),
("Can't Redo", ""),
("Cut", ""),
("Copy", ""),
("Paste", ""),
("Delete", ""),
("Select All", ""),
("Edit Body...", "..."),
("Extract Section", "Extract Section"),
("Extract Names", "Extract Names"),
("Extract", "Extract"),
("Convert All Blanks", "Convert All Blanks"),
("Convert All Tabs", "Convert All Tabs"),
("Convert Blanks", "Convert Blanks"),
("Convert Tabs", "Convert Tabs"),
("Insert Body Time/Date", "/"),
("Reformat Paragraph", ""),
("Indent", ""),
("Unindent", ""),
("Match Brackets", ""), # <({["), #EKR
("Edit Headline...", "..."),
("Edit Headline", ""),
("End Edit Headline", ""),
("Abort Edit Headline", ""),
("Insert Headline Time/Date", "/"),
("Toggle Angle Brackets", ""),
("Find...", "..."),
("Find Panel", ""),
("Find Next", ""),
("Find Previous", ""),
("Replace", ""),
("Replace, Then Find", ""),
("Go To Line Number", "..."),
("Execute Script", "Python"),
("Set Font...", "..."),
("Set Colors...", "..."),
("Show Invisibles", ""),
("Hide Invisibles", ""),
("Preferences", ""),
#@-node:ekr.20040828105233.3:edit menu
#@+node:ekr.20040828105233.4:outline menu
("Outline", "Outline"),
("Cut Node", ""),
("Copy Node", ""),
("Paste Node", ""),
("Delete Node", ""),
("Insert Node", ""),
("Clone Node", ""),
("Sort Children", ""),
("Sort Siblings", ""),
("Check Outline", ""),
("Dump Outline", " (Dump)"),
("Hoist", " (Hoist)"),
("De-Hoist", " (De-Hoist)"),
("Expand/Contract...", "/"),
("Contract All", ""),
("Contract Node", ""),
("Contract Parent", ""),
("Expand Prev Level", ""),
("Expand Next Level", ""),
("Expand To Level 1", "1"),
("Expand To Level 2", "2"),
("Expand To Level 3", "3"),
("Expand To Level 4", "4"),
("Expand To Level 5", "5"),
("Expand To Level 6", "6"),
("Expand To Level 7", "7"),
("Expand To Level 8", "8"),
("Expand All", ""),
("Expand Node", ""),
("Move...", "..."),
("Move Down", ""),
("Move Left", ""),
("Move Right", ""),
("Move Up", ""),
("Promote", "Promote"),
("Demote", "Demote"),
("Mark/Unmark...", "..."),
("Mark", ""),
("Unmark", ""),
("Mark Subheads", ""),
("Mark Changed Items", ""),
("Mark Changed Roots", " (Roots)"),
("Mark Clones", ""),
("Unmark All", ""),
("Go To...", "..."),
("Go Back", ""),
("Go Forward", ""),
("Go To Next Marked", ""),
("Go To Next Changed", ""),
("Go To Next Clone", ""),
("Go To First Node", ""),
("Go To Last Node", ""),
("Go To Parent", ""),
("Go To Prev Sibling", ""),
("Go To Next Sibling", ""),
("Go To Prev Visible", ""),
("Go To Next Visible", ""),
("Go To Prev Node", ""),
("Go To Next Node", ""),
#@nonl
#@-node:ekr.20040828105233.4:outline menu
#@+node:ekr.20040828105233.5:plugins menu
("Plugins", "Plugins"),
("chinese", "Chinese ()"),
#@-node:ekr.20040828105233.5:plugins menu
#@+node:ekr.20040828105233.6:window menu
("Window", "Window"),
("Equal Sized Panes", ""),
("Toggle Active Pane", ""),
("Toggle Split Direction", ""),
("Cascade", ""),
("Minimize All", ""),
("Open Compare Window", "..."),
("Open Python Window", "Python(IDLE)..."),
#@-node:ekr.20040828105233.6:window menu
#@+node:ekr.20040828105233.7:help menu
("Help", "Help"),
("About Leo...", "Leo..."),
("Online Home Page", ""),
("Open Online Tutorial", ""),
("Open Offline Tutorial", " (CHM)"),
("Open LeoDocs.leo", " LeoDocs.leo"),
("Open LeoConfig.leo", " LeoConfig.leo"),
("Apply Settings", "")
#@nonl
#@-node:ekr.20040828105233.7:help menu
#@-others
)
# Call the convenience routine to do the work.
c.frame.menu.setRealMenuNamesFromTable(table)
#@nonl
#@-node:ekr.20040828105233.1:onMenu
#@-others
if not g.app.unitTesting: # Unpleasant for unit testing.
# Register the handlers...
leoPlugins.registerHandler("menu2", onMenu)
__version__ = "1.1" # Set version for the plugin handler.
g.plugin_signon(__name__)
#@nonl
#@-node:ekr.20040828105233:@thin examples/chinese_menu.py
#@-leo
|