chinese_menu.py :  » Development » Leo » Leo-4.7.1-final » leo » plugins » examples » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » Leo 
Leo » Leo 4.7.1 final » leo » plugins » examples » chinese_menu.py
# -*- 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
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.