Revert "Revert "Update APIs, check grammars""

This reverts commit 5e083473e7b4d3a6014d35e68618594765151afe.
This commit is contained in:
Plusb Preco 2015-07-12 13:23:54 +09:00
parent eb81810a52
commit e510384375
19 changed files with 235 additions and 232 deletions

View file

@ -1,12 +1,10 @@
# menu
The `Menu` class is used to create native menus that can be used as
application menus and context menus. Each menu consists of multiple menu
items, and each menu item can have a submenu.
`Menu` 클래스는 어플리케이션 메뉴와 컨텍스트 메뉴를 만들 때 사용할 수 있습니다.
각 메뉴는 여러 개의 메뉴 아이템으로 구성되어 있으며 서브 메뉴를 가질 수도 있습니다.
Below is an example of creating a menu dynamically in a web page by using
the [remote](remote-ko.md) module, and showing it when the user right clicks
the page:
다음 예제는 웹 페이지 내에서 [remote](remote-ko.md) 모듈을 활용하여 동적으로 메뉴를 생성하는 예제입니다.
그리고 이 예제에서 만들어진 메뉴는 유저가 페이지에서 오른쪽 클릭을 할 때 마우스 위치에 팝업으로 표시됩니다:
```html
<!-- index.html -->
@ -27,7 +25,7 @@ window.addEventListener('contextmenu', function (e) {
</script>
```
Another example of creating the application menu with the simple template API:
다음 예제는 template API를 활용하여 어플리케이션 메뉴를 만드는 간단한 예제입니다:
```html
<!-- index.html -->
@ -167,34 +165,30 @@ Menu.setApplicationMenu(menu);
### new Menu()
Creates a new menu.
새로운 메뉴를 생성합니다.
### Class Method: Menu.setApplicationMenu(menu)
* `menu` Menu
Sets `menu` as the application menu on OS X. On Windows and Linux, the `menu`
will be set as each window's top menu.
지정한 `menu`를 이용하여 어플리케이션 메뉴를 만듭니다. OS X에선 상단바에 표시되며 Windows와 Linux에선 각 창의 상단에 표시됩니다.
### Class Method: Menu.sendActionToFirstResponder(action)
* `action` String
Sends the `action` to the first responder of application, this is used for
emulating default Cocoa menu behaviors, usually you would just use the
`selector` property of `MenuItem`.
`action`을 어플리케이션의 first responder에 전달합니다.
이 함수는 Cocoa 메뉴 동작을 에뮬레이트 하는데 사용되며 보통 `MenuItem``selector` 속성에 사용됩니다.
**Note:** This method is OS X only.
**알림:** 이 함수는 OS X에서만 사용할 수 있습니다.
### Class Method: Menu.buildFromTemplate(template)
* `template` Array
Generally, the `template` is just an array of `options` for constructing
[MenuItem](menu-item-ko.md), the usage can be referenced above.
기본적으로 `template`는 [MenuItem](menu-item-ko.md)을 생성할 때 사용하는 `options`의 배열입니다. 사용법은 위에서 설명한 것과 같습니다.
You can also attach other fields to element of the `template`, and they will
become properties of the constructed menu items.
또한 `template`에는 다른 속성도 추가할 수 있으며 메뉴가 만들어질 때 해당 메뉴 아이템의 프로퍼티로 변환됩니다.
### Menu.popup(browserWindow, [x, y])
@ -202,86 +196,70 @@ become properties of the constructed menu items.
* `x` Number
* `y` Number
Popups this menu as a context menu in the `browserWindow`. You can optionally
provide a `(x,y)` coordinate to place the menu at, otherwise it will be placed
at the current mouse cursor position.
메뉴를 `browserWindow` 안에서 팝업으로 표시합니다.
옵션으로 메뉴를 표시할 `(x,y)` 좌표를 임의로 지정할 수 있습니다. 따로 지정하지 않은 경우 마우스 커서 위치에 표시됩니다.
### Menu.append(menuItem)
* `menuItem` MenuItem
Appends the `menuItem` to the menu.
메뉴의 리스트 끝에 `menuItem`을 삽입합니다.
### Menu.insert(pos, menuItem)
* `pos` Integer
* `menuItem` MenuItem
Inserts the `menuItem` to the `pos` position of the menu.
`pos` 위치에 `menuItem`을 삽입합니다.
### Menu.items
Get the array containing the menu's items.
메뉴가 가지고 있는 메뉴 아이템들의 배열입니다.
## Notes on OS X application menu
## OS X 어플리케이션 메뉴에 대해 알아 둬야 할 것들
OS X has a completely different style of application menu from Windows and
Linux, and here are some notes on making your app's menu more native-like.
OS X에선 Windows, Linux와 달리 완전히 다른 어플리케이션 메뉴 스타일을 가지고 있습니다.
어플리케이션을 네이티브처럼 작동할 수 있도록 하기 위해선 다음의 몇 가지 유의 사항을 숙지해야 합니다.
### Standard menus
### 기본 메뉴
On OS X there are many system defined standard menus, like the `Services` and
`Windows` menus. To make your menu a standard menu, you can just set your menu's
label to one of followings, and Electron will recognize them and make them
become standard menus:
OS X엔 `Services``Windows`와 같은 많은 시스템 지정 기본 메뉴가 있습니다.
기본 메뉴를 만들려면 다음 중 하나를 메뉴의 라벨로 지정하기만 하면 됩니다.
그러면 Electron이 자동으로 인식하여 해당 메뉴를 기본 메뉴로 만듭니다:
* `Window`
* `Help`
* `Services`
### Standard menu item actions
### 기본 메뉴 아이템 동작
OS X has provided standard actions for some menu items (which are called
`selector`s), like `About xxx`, `Hide xxx`, and `Hide Others`. To set the action
of a menu item to a standard action, you can set the `selector` attribute of the
menu item.
OS X는 몇몇의 메뉴 아이템에 대해 `About xxx`, `Hide xxx`, `Hide Others`와 같은 기본 동작을 제공하고 있습니다. (`selector`라고 불립니다)
메뉴 아이템의 기본 동작을 지정하려면 메뉴 아이템의 `selector` 속성을 사용하면 됩니다.
### Main menu's name
### 메인 메뉴의 이름
On OS X the label of application menu's first item is always your app's name,
no matter what label you set. To change it you have to change your app's name
by modifying your app bundle's `Info.plist` file. See
[About Information Property List Files](https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html)
for more.
OS X에선 지정한 어플리케이션 메뉴에 상관없이 메뉴의 첫번째 라벨은 언제나 어플리케이션의 이름이 됩니다.
어플리케이션 이름을 변경하려면 앱 번들내의 `Info.plist` 파일을 수정해야합니다.
자세한 내용은 [About Information Property List Files](https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html)을 참고하세요.
## 메뉴 아이템 위치
## Menu item position
`Menu.buildFromTemplate`로 메뉴를 만들 때 `position``id`를 사용해서 아이템의 위치를 지정할 수 있습니다.
You can make use of `position` and `id` to control how the item would be placed
when building a menu with `Menu.buildFromTemplate`.
`MenuItem``position` 속성은 `[placement]=[id]`와 같은 형식을 가지며 `placement`
`before`, `after`, `endof` 속성 중 한가지를 사용할 수 있고 `id`는 메뉴 아이템이 가지는 유일 ID 입니다:
The `position` attribute of `MenuItem` has the form `[placement]=[id]` where
placement is one of `before`, `after`, or `endof` and `id` is the unique ID of
an existing item in the menu:
* `before` - 이 아이템을 지정한 id 이전의 위치에 삽입합니다. 만약 참조된 아이템이 없을 경우 메뉴의 맨 뒤에 삽입됩니다.
* `after` - 이 아이템을 지정한 id 다음의 위치에 삽입합니다. 만약 참조된 아이템이 없을 경우 메뉴의 맨 뒤에 삽입됩니다.
* `endof` - 이 아이템을 id의 논리 그룹에 맞춰서 각 그룹의 항목 뒤에 삽입합니다. (그룹은 분리자 아이템에 의해 만들어집니다)
만약 참조된 아이템의 분리자 그룹이 존재하지 않을 경우 지정된 id로 새로운 분리자 그룹을 만든 후 해당 그룹의 뒤에 삽입됩니다.
* `before` - Inserts this item before the id referenced item. If the
referenced item doesn't exist the item will be inserted at the end of
the menu.
* `after` - Inserts this item after id referenced item. If the referenced
item doesn't exist the item will be inserted at the end of the menu.
* `endof` - Inserts this item at the end of the logical group containing
the id referenced item. (Groups are created by separator items). If
the referenced item doesn't exist a new separator group is created with
the given id and this item is inserted after that separator.
위치를 지정한 아이템의 뒤에 위치가 지정되지 않은 아이템이 있을 경우 해당 아이템의 위치가 지정되기 전까지 이전에 위치가 지정된 아이템의 위치 지정을 따릅니다.
이에 따라 위치를 이동하고 싶은 특정 그룹의 아이템들이 있을 경우 해당 그룹의 맨 첫번째 메뉴 아이템의 위치만을 지정하면 됩니다.
When an item is positioned following unpositioned items are inserted after
it, until a new item is positioned. So if you want to position a group of
menu items in the same location you only need to specify a position for
the first item.
### 예제
### Examples
Template:
메뉴 템플릿:
```javascript
[
@ -293,7 +271,7 @@ Template:
]
```
Menu:
메뉴:
```
- 1
@ -303,7 +281,7 @@ Menu:
- 5
```
Template:
메뉴 템플릿:
```javascript
[
@ -316,7 +294,7 @@ Template:
]
```
Menu:
메뉴:
```
- ---