Preliminary i18n implementation as outlined in JEP 16 (#2140)

setting up internationalization for log and UI messages

See i18n README for details

Squashed to resolve CRLF, tab-indent issues.
John Emmons 9 years ago committed by Min RK
parent 8fa09260b1
commit f81fb46ff6

3
.gitignore vendored

@ -33,3 +33,6 @@ src
Read the Docs
config.rst
/.project
/.pydevproject

@ -9,6 +9,7 @@
"es6-promise": "~1.0",
"font-awesome": "components/font-awesome#~4.7.0",
"google-caja": "5669",
"jed": "~1.1.1",
"jquery": "components/jquery#~2.0",
"jquery-typeahead": "~2.0.0",
"jquery-ui": "components/jqueryui#~1.10",
@ -19,6 +20,8 @@
"preact-compat": "https://unpkg.com/preact-compat@^3.14.3/dist/preact-compat.min.js",
"proptypes": "https://unpkg.com/proptypes@^0.14.4/index.js",
"requirejs": "~2.1",
"requirejs-text": "~2.0.15",
"requirejs-plugins": "~1.0.3",
"text-encoding": "~0.1",
"underscore": "components/underscore#~1.8.3",
"xterm.js": "sourcelair/xterm.js#~2.8.1"

@ -0,0 +1,122 @@
# Implementation Notes for Internationalization of Jupyter Notebook
This is a prototype implementation of i18n features for Jupyter notebook, and should not
yet be considered ready for production use. I have tried to focus on the public user
interfaces in the notebook for the first cut, while leaving much of the console messages
behind, as their usefulness in a translated environment is questionable at best.
### Using a prototype translated version
In order to use this preliminary version, you need to do things after installing the
notebook as normal:
1. Set the LANG environment variable in your shell to "xx_XX" or just "xx".
where "xx" is the language code you're wanting to run in. If you're
running on Windows, I've found the easiest way to do this is to use Windows PowerShell,
and run the command:
`${Env:LANG} = "xx_XX"`
2. Set the preferred language for web pages in your browser to YourLanguage (xx). At the moment,
it has to be first in the list.
3. Run the `jupyter notebook` command to start the notebook.
### Message extraction:
I have split out the translatable material for the notebook into 3 POT, as follows:
notebook/i18n/notebook.pot - Console and startup messages, basically anything that is
produced by Python code.
notebook/i18n/nbui.pot - User interface strings, as extracted from the Jinja2 templates
in notebook/templates/*.html
noteook/i18n/nbjs.pot - JavaScript strings and dialogs, which contain much of the visible
user interface for Jupyter notebook.
To extract the messages from the source code whenever new material is added, use the
`pybabel` command to extract messages from the source code as follows:
( assuming you are in the base directory for Jupyter notebook )
`pybabel extract -F notebook/i18n/babel_notebook.cfg -o notebook/i18n/notebook.pot --no-wrap --project Jupyter .`
`pybabel extract -F notebook/i18n/babel_nbui.cfg -o notebook/i18n/nbui.pot --no-wrap --project Jupyter .`
`pybabel extract -F notebook/i18n/babel_nbjs.cfg -o notebook/i18n/nbjs.pot --no-wrap --project Jupyter .`
(Note: there is a '.' at the end of these commands, and it has to be there...)
After this is complete you have 3 POT files that you can give to a translator for your favorite language.
Babel's documentation has instructions on how to integrate this into your setup.py so that eventually
we can just do:
`setup.py extract_messages`
I hope to get this working at some point in the near future.
### Post translation procedures
After the source material has been translated, you should have 3 PO files with the same base names
as the POT files above. Put them in `notebook/i18n/${LANG}/LC_MESSAGES`, where ${LANG} is the language
code for your desired language ( i.e. German = "de", Japanese = "ja", etc. ). The first 2 files then
need to be converted from PO to MO format for use at runtime. There are many different ways to do
this, but pybabel has an option to do this as follows:
`pybabel compile -D notebook -f -l ${LANG} -i notebook/i18n/${LANG}/LC_MESSAGES/notebook.po -o notebook/i18n/${LANG}/notebook.mo`
`pybabel compile -D nbui -f -l ${LANG} -i notebook/i18n/${LANG}/LC_MESSAGES/nbui.po -o notebook/i18n/${LANG}/nbui.mo`
The nbjs.po needs to be converted to JSON for use within the JavaScript code. I'm using po2json for this, as follows:
`po2json -p -F -f jed1.x -d nbjs notebook/i18n/${LANG}/LC_MESSAGES/nbjs.po notebook/i18n/${LANG}/LC_MESSAGES/nbjs.json`
The conversions from PO to MO probably can and should be done during setup.py.
When new languages get added, their language codes should be added to notebook/i18n/nbjs.json
under the "supported_languages" element.
### Tips for Jupyter developers
The biggest "mistake" I found while doing i18n enablement was the habit of constructing UI messages
from English "piece parts". For example, code like:
`var msg = "Enter a new " + type + "name:"`
where "type" is either "file", "directory", or "notebook"....
is problematic when doing translations, because the surrounding text may need to vary
depending on the inserted word. In this case, you need to switch it and use complete phrases,
as follows:
```javascript
var rename_msg = function (type) {
switch(type) {
case 'file': return _("Enter a new file name:");
case 'directory': return _("Enter a new directory name:");
case 'notebook': return _("Enter a new notebook name:");
default: return _("Enter a new name:");
}
}
```
Also you need to remember that adding an "s" or "es" to an English word to
create the plural form doesn't translate well. Some languages have as many as 5 or 6 different
plural forms for differing numbers, so using an API such as ngettext() is necessary in order
to handle these cases properly.
### Known issues
1. Right now there are two different places where the desired language is set. At startup time, the Jupyter console's messages pay attention to the setting of the ${LANG} environment variable
as set in the shell at startup time. Unfortunately, this is also the time where the Jinja2
environment is set up, which means that the template stuff will always come from this setting.
We really want to be paying attention to the browser's settings for the stuff that happens in the
browser, so we need to be able to retrieve this information after the browser is started and somehow
communicate this back to Jinja2. So far, I haven't yet figured out how to do this, which means that if the ${LANG} at startup doesn't match the browser's settings, you could potentially get a mix
of languages in the UI ( never a good thing ).
2. We will need to decide if console messages should be translatable, and enable them if desired.
3. The keyboard shorcut editor was implemented after the i18n work was completed, so that portion
does not have translation support at this time.
Any questions or comments please let me know @JCEmmons on github (emmo@us.ibm.com)

@ -0,0 +1,11 @@
[javascript: notebook/static/base/js/*.js]
extract_messages = $._, i18n.msg._
[javascript: notebook/static/notebook/js/*.js]
extract_messages = $._, i18n.msg._
[javascript: notebook/static/notebook/js/celltoolbarpresets/*.js]
extract_messages = $._, i18n.msg._
[javascript: notebook/static/tree/js/*.js]
extract_messages = $._, i18n.msg._

@ -0,0 +1,4 @@
[jinja2: notebook/templates/**.html]
encoding = utf-8
[extractors]
jinja2 = jinja2.ext:babel_extract

@ -0,0 +1,2 @@
[python: notebook/*.py]
[python: notebook/services/contents/*.py]

@ -0,0 +1,12 @@
{
"domain": "nbjs",
"supported_languages": [
],
"locale_data": {
"nbjs": {
"": {
"domain": "nbjs"
}
}
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,731 @@
# Translations template for Jupyter.
# Copyright (C) 2017 ORGANIZATION
# This file is distributed under the same license as the Jupyter project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2017.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Jupyter VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2017-07-07 12:48-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
#: notebook/templates/404.html:3
msgid "You are requesting a page that does not exist!"
msgstr ""
#: notebook/templates/edit.html:37
msgid "current mode"
msgstr ""
#: notebook/templates/edit.html:48 notebook/templates/notebook.html:78
msgid "File"
msgstr ""
#: notebook/templates/edit.html:50 notebook/templates/tree.html:57
msgid "New"
msgstr ""
#: notebook/templates/edit.html:51
msgid "Save"
msgstr ""
#: notebook/templates/edit.html:52 notebook/templates/tree.html:36
msgid "Rename"
msgstr ""
#: notebook/templates/edit.html:53 notebook/templates/tree.html:38
msgid "Download"
msgstr ""
#: notebook/templates/edit.html:56 notebook/templates/notebook.html:131
#: notebook/templates/tree.html:41
msgid "Edit"
msgstr ""
#: notebook/templates/edit.html:58
msgid "Find"
msgstr ""
#: notebook/templates/edit.html:59
msgid "Find &amp; Replace"
msgstr ""
#: notebook/templates/edit.html:61
msgid "Key Map"
msgstr ""
#: notebook/templates/edit.html:62
msgid "Default"
msgstr ""
#: notebook/templates/edit.html:63
msgid "Sublime Text"
msgstr ""
#: notebook/templates/edit.html:68 notebook/templates/notebook.html:159
#: notebook/templates/tree.html:40
msgid "View"
msgstr ""
#: notebook/templates/edit.html:70 notebook/templates/notebook.html:162
msgid "Show/Hide the logo and notebook title (above menu bar)"
msgstr ""
#: notebook/templates/edit.html:71 notebook/templates/notebook.html:163
msgid "Toggle Header"
msgstr ""
#: notebook/templates/edit.html:72 notebook/templates/notebook.html:171
msgid "Toggle Line Numbers"
msgstr ""
#: notebook/templates/edit.html:75
msgid "Language"
msgstr ""
#: notebook/templates/error.html:23
msgid "The error was:"
msgstr ""
#: notebook/templates/login.html:24
msgid "Password or token:"
msgstr ""
#: notebook/templates/login.html:26
msgid "Password:"
msgstr ""
#: notebook/templates/login.html:31
msgid "Log in"
msgstr ""
#: notebook/templates/login.html:39
msgid "No login available, you shouldn't be seeing this page."
msgstr ""
#: notebook/templates/logout.html:24
#, python-format
msgid "Proceed to the <a href=\"%(base_url)s\">dashboard"
msgstr ""
#: notebook/templates/logout.html:26
#, python-format
msgid "Proceed to the <a href=\"%(base_url)slogin\">login page"
msgstr ""
#: notebook/templates/notebook.html:62
msgid "Menu"
msgstr ""
#: notebook/templates/notebook.html:65 notebook/templates/notebook.html:254
msgid "Kernel"
msgstr ""
#: notebook/templates/notebook.html:68
msgid "This notebook is read-only"
msgstr ""
#: notebook/templates/notebook.html:81
msgid "New Notebook"
msgstr ""
#: notebook/templates/notebook.html:85
msgid "Opens a new window with the Dashboard view"
msgstr ""
#: notebook/templates/notebook.html:86
msgid "Open..."
msgstr ""
#: notebook/templates/notebook.html:90
msgid "Open a copy of this notebook's contents and start a new kernel"
msgstr ""
#: notebook/templates/notebook.html:91
msgid "Make a Copy..."
msgstr ""
#: notebook/templates/notebook.html:92
msgid "Rename..."
msgstr ""
#: notebook/templates/notebook.html:93
msgid "Save and Checkpoint"
msgstr ""
#: notebook/templates/notebook.html:96
msgid "Revert to Checkpoint"
msgstr ""
#: notebook/templates/notebook.html:106
msgid "Print Preview"
msgstr ""
#: notebook/templates/notebook.html:107
msgid "Download as"
msgstr ""
#: notebook/templates/notebook.html:109
msgid "Notebook (.ipynb)"
msgstr ""
#: notebook/templates/notebook.html:110
msgid "Script"
msgstr ""
#: notebook/templates/notebook.html:111
msgid "HTML (.html)"
msgstr ""
#: notebook/templates/notebook.html:112
msgid "Markdown (.md)"
msgstr ""
#: notebook/templates/notebook.html:113
msgid "reST (.rst)"
msgstr ""
#: notebook/templates/notebook.html:114
msgid "LaTeX (.tex)"
msgstr ""
#: notebook/templates/notebook.html:115
msgid "PDF via LaTeX (.pdf)"
msgstr ""
#: notebook/templates/notebook.html:118
msgid "Deploy as"
msgstr ""
#: notebook/templates/notebook.html:123
msgid "Trust the output of this notebook"
msgstr ""
#: notebook/templates/notebook.html:124
msgid "Trust Notebook"
msgstr ""
#: notebook/templates/notebook.html:127
msgid "Shutdown this notebook's kernel, and close this window"
msgstr ""
#: notebook/templates/notebook.html:128
msgid "Close and Halt"
msgstr ""
#: notebook/templates/notebook.html:133
msgid "Cut Cells"
msgstr ""
#: notebook/templates/notebook.html:134
msgid "Copy Cells"
msgstr ""
#: notebook/templates/notebook.html:135
msgid "Paste Cells Above"
msgstr ""
#: notebook/templates/notebook.html:136
msgid "Paste Cells Below"
msgstr ""
#: notebook/templates/notebook.html:137
msgid "Paste Cells &amp; Replace"
msgstr ""
#: notebook/templates/notebook.html:138
msgid "Delete Cells"
msgstr ""
#: notebook/templates/notebook.html:139
msgid "Undo Delete Cells"
msgstr ""
#: notebook/templates/notebook.html:141
msgid "Split Cell"
msgstr ""
#: notebook/templates/notebook.html:142
msgid "Merge Cell Above"
msgstr ""
#: notebook/templates/notebook.html:143
msgid "Merge Cell Below"
msgstr ""
#: notebook/templates/notebook.html:145
msgid "Move Cell Up"
msgstr ""
#: notebook/templates/notebook.html:146
msgid "Move Cell Down"
msgstr ""
#: notebook/templates/notebook.html:148
msgid "Edit Notebook Metadata"
msgstr ""
#: notebook/templates/notebook.html:150
msgid "Find and Replace"
msgstr ""
#: notebook/templates/notebook.html:152
msgid "Cut Cell Attachments"
msgstr ""
#: notebook/templates/notebook.html:153
msgid "Copy Cell Attachments"
msgstr ""
#: notebook/templates/notebook.html:154
msgid "Paste Cell Attachments"
msgstr ""
#: notebook/templates/notebook.html:156
msgid "Insert Image"
msgstr ""
#: notebook/templates/notebook.html:166
msgid "Show/Hide the action icons (below menu bar)"
msgstr ""
#: notebook/templates/notebook.html:167
msgid "Toggle Toolbar"
msgstr ""
#: notebook/templates/notebook.html:170
msgid "Show/Hide line numbers in cells"
msgstr ""
#: notebook/templates/notebook.html:174
msgid "Cell Toolbar"
msgstr ""
#: notebook/templates/notebook.html:179
msgid "Insert"
msgstr ""
#: notebook/templates/notebook.html:182
msgid "Insert an empty Code cell above the currently active cell"
msgstr ""
#: notebook/templates/notebook.html:183
msgid "Insert Cell Above"
msgstr ""
#: notebook/templates/notebook.html:185
msgid "Insert an empty Code cell below the currently active cell"
msgstr ""
#: notebook/templates/notebook.html:186
msgid "Insert Cell Below"
msgstr ""
#: notebook/templates/notebook.html:189
msgid "Cell"
msgstr ""
#: notebook/templates/notebook.html:191
msgid "Run this cell, and move cursor to the next one"
msgstr ""
#: notebook/templates/notebook.html:192
msgid "Run Cells"
msgstr ""
#: notebook/templates/notebook.html:193
msgid "Run this cell, select below"
msgstr ""
#: notebook/templates/notebook.html:194
msgid "Run Cells and Select Below"
msgstr ""
#: notebook/templates/notebook.html:195
msgid "Run this cell, insert below"
msgstr ""
#: notebook/templates/notebook.html:196
msgid "Run Cells and Insert Below"
msgstr ""
#: notebook/templates/notebook.html:197
msgid "Run all cells in the notebook"
msgstr ""
#: notebook/templates/notebook.html:198
msgid "Run All"
msgstr ""
#: notebook/templates/notebook.html:199
msgid "Run all cells above (but not including) this cell"
msgstr ""
#: notebook/templates/notebook.html:200
msgid "Run All Above"
msgstr ""
#: notebook/templates/notebook.html:201
msgid "Run this cell and all cells below it"
msgstr ""
#: notebook/templates/notebook.html:202
msgid "Run All Below"
msgstr ""
#: notebook/templates/notebook.html:205
msgid "All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells"
msgstr ""
#: notebook/templates/notebook.html:206
msgid "Cell Type"
msgstr ""
#: notebook/templates/notebook.html:209
msgid "Contents will be sent to the kernel for execution, and output will display in the footer of cell"
msgstr ""
#: notebook/templates/notebook.html:212
msgid "Contents will be rendered as HTML and serve as explanatory text"
msgstr ""
#: notebook/templates/notebook.html:213 notebook/templates/notebook.html:298
msgid "Markdown"
msgstr ""
#: notebook/templates/notebook.html:215
msgid "Contents will pass through nbconvert unmodified"
msgstr ""
#: notebook/templates/notebook.html:216
msgid "Raw NBConvert"
msgstr ""
#: notebook/templates/notebook.html:220
msgid "Current Outputs"
msgstr ""
#: notebook/templates/notebook.html:223
msgid "Hide/Show the output of the current cell"
msgstr ""
#: notebook/templates/notebook.html:224 notebook/templates/notebook.html:240
msgid "Toggle"
msgstr ""
#: notebook/templates/notebook.html:227
msgid "Scroll the output of the current cell"
msgstr ""
#: notebook/templates/notebook.html:228 notebook/templates/notebook.html:244
msgid "Toggle Scrolling"
msgstr ""
#: notebook/templates/notebook.html:231
msgid "Clear the output of the current cell"
msgstr ""
#: notebook/templates/notebook.html:232 notebook/templates/notebook.html:248
msgid "Clear"
msgstr ""
#: notebook/templates/notebook.html:236
msgid "All Output"
msgstr ""
#: notebook/templates/notebook.html:239
msgid "Hide/Show the output of all cells"
msgstr ""
#: notebook/templates/notebook.html:243
msgid "Scroll the output of all cells"
msgstr ""
#: notebook/templates/notebook.html:247
msgid "Clear the output of all cells"
msgstr ""
#: notebook/templates/notebook.html:257
msgid "Send Keyboard Interrupt (CTRL-C) to the Kernel"
msgstr ""
#: notebook/templates/notebook.html:258
msgid "Interrupt"
msgstr ""
#: notebook/templates/notebook.html:261
msgid "Restart the Kernel"
msgstr ""
#: notebook/templates/notebook.html:262
msgid "Restart"
msgstr ""
#: notebook/templates/notebook.html:265
msgid "Restart the Kernel and clear all output"
msgstr ""
#: notebook/templates/notebook.html:266
msgid "Restart &amp; Clear Output"
msgstr ""
#: notebook/templates/notebook.html:269
msgid "Restart the Kernel and re-run the notebook"
msgstr ""
#: notebook/templates/notebook.html:270
msgid "Restart &amp; Run All"
msgstr ""
#: notebook/templates/notebook.html:273
msgid "Reconnect to the Kernel"
msgstr ""
#: notebook/templates/notebook.html:274
msgid "Reconnect"
msgstr ""
#: notebook/templates/notebook.html:282
msgid "Change kernel"
msgstr ""
#: notebook/templates/notebook.html:287
msgid "Help"
msgstr ""
#: notebook/templates/notebook.html:290
msgid "A quick tour of the notebook user interface"
msgstr ""
#: notebook/templates/notebook.html:290
msgid "User Interface Tour"
msgstr ""
#: notebook/templates/notebook.html:291
msgid "Opens a tooltip with all keyboard shortcuts"
msgstr ""
#: notebook/templates/notebook.html:291
msgid "Keyboard Shortcuts"
msgstr ""
#: notebook/templates/notebook.html:292
msgid "Opens a dialog allowing you to edit Keyboard shortcuts"
msgstr ""
#: notebook/templates/notebook.html:292
msgid "Edit Keyboard Shortcuts"
msgstr ""
#: notebook/templates/notebook.html:297
msgid "Notebook Help"
msgstr ""
#: notebook/templates/notebook.html:303
msgid "Opens in a new window"
msgstr ""
#: notebook/templates/notebook.html:319
msgid "About Jupyter Notebook"
msgstr ""
#: notebook/templates/notebook.html:319
msgid "About"
msgstr ""
#: notebook/templates/page.html:114
msgid "Jupyter Notebook requires JavaScript."
msgstr ""
#: notebook/templates/page.html:115
msgid "Please enable it to proceed. "
msgstr ""
#: notebook/templates/page.html:121
msgid "dashboard"
msgstr ""
#: notebook/templates/page.html:132
msgid "Logout"
msgstr ""
#: notebook/templates/page.html:134
msgid "Login"
msgstr ""
#: notebook/templates/tree.html:23
msgid "Files"
msgstr ""
#: notebook/templates/tree.html:24
msgid "Running"
msgstr ""
#: notebook/templates/tree.html:25
msgid "Clusters"
msgstr ""
#: notebook/templates/tree.html:32
msgid "Select items to perform actions on them."
msgstr ""
#: notebook/templates/tree.html:35
msgid "Duplicate selected"
msgstr ""
#: notebook/templates/tree.html:35
msgid "Duplicate"
msgstr ""
#: notebook/templates/tree.html:36
msgid "Rename selected"
msgstr ""
#: notebook/templates/tree.html:37
msgid "Move selected"
msgstr ""
#: notebook/templates/tree.html:37
msgid "Move"
msgstr ""
#: notebook/templates/tree.html:38
msgid "Download selected"
msgstr ""
#: notebook/templates/tree.html:39
msgid "Shutdown selected notebook(s)"
msgstr ""
#: notebook/templates/tree.html:39
msgid "Shutdown"
msgstr ""
#: notebook/templates/tree.html:40
msgid "View selected"
msgstr ""
#: notebook/templates/tree.html:41
msgid "Edit selected"
msgstr ""
#: notebook/templates/tree.html:42
msgid "Delete selected"
msgstr ""
#: notebook/templates/tree.html:50
msgid "Click to browse for a file to upload."
msgstr ""
#: notebook/templates/tree.html:51
msgid "Upload"
msgstr ""
#: notebook/templates/tree.html:65
msgid "Text File"
msgstr ""
#: notebook/templates/tree.html:68
msgid "Folder"
msgstr ""
#: notebook/templates/tree.html:72
msgid "Terminal"
msgstr ""
#: notebook/templates/tree.html:76
msgid "Terminals Unavailable"
msgstr ""
#: notebook/templates/tree.html:82
msgid "Refresh notebook list"
msgstr ""
#: notebook/templates/tree.html:90
msgid "Select All / None"
msgstr ""
#: notebook/templates/tree.html:93
msgid "Select..."
msgstr ""
#: notebook/templates/tree.html:98
msgid "Select All Folders"
msgstr ""
#: notebook/templates/tree.html:98
msgid " Folders"
msgstr ""
#: notebook/templates/tree.html:99
msgid "Select All Notebooks"
msgstr ""
#: notebook/templates/tree.html:99
msgid " All Notebooks"
msgstr ""
#: notebook/templates/tree.html:100
msgid "Select Running Notebooks"
msgstr ""
#: notebook/templates/tree.html:100
msgid " Running"
msgstr ""
#: notebook/templates/tree.html:101
msgid "Select All Files"
msgstr ""
#: notebook/templates/tree.html:101
msgid " Files"
msgstr ""
#: notebook/templates/tree.html:114
msgid "Last Modified"
msgstr ""
#: notebook/templates/tree.html:120
msgid "Name"
msgstr ""
#: notebook/templates/tree.html:130
msgid "Currently running Jupyter processes"
msgstr ""
#: notebook/templates/tree.html:134
msgid "Refresh running list"
msgstr ""
#: notebook/templates/tree.html:150
msgid "There are no terminals running."
msgstr ""
#: notebook/templates/tree.html:152
msgid "Terminals are unavailable."
msgstr ""
#: notebook/templates/tree.html:162
msgid "Notebooks"
msgstr ""
#: notebook/templates/tree.html:169
msgid "There are no notebooks running."
msgstr ""
#: notebook/templates/tree.html:178
msgid "Clusters tab is now provided by IPython parallel."
msgstr ""
#: notebook/templates/tree.html:179
msgid "See '<a href=\"https://github.com/ipython/ipyparallel\">IPython parallel</a>' for installation details."
msgstr ""

@ -0,0 +1,480 @@
# Translations template for Jupyter.
# Copyright (C) 2017 ORGANIZATION
# This file is distributed under the same license as the Jupyter project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2017.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Jupyter VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2017-07-08 21:52-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
#: notebook/notebookapp.py:53
msgid "The Jupyter Notebook requires tornado >= 4.0"
msgstr ""
#: notebook/notebookapp.py:57
msgid "The Jupyter Notebook requires tornado >= 4.0, but you have < 1.1.0"
msgstr ""
#: notebook/notebookapp.py:59
#, python-format
msgid "The Jupyter Notebook requires tornado >= 4.0, but you have %s"
msgstr ""
#: notebook/notebookapp.py:209
msgid "The `ignore_minified_js` flag is deprecated and no longer works."
msgstr ""
#: notebook/notebookapp.py:210
#, python-format
msgid "Alternatively use `%s` when working on the notebook's Javascript and LESS"
msgstr ""
#: notebook/notebookapp.py:211
msgid "The `ignore_minified_js` flag is deprecated and will be removed in Notebook 6.0"
msgstr ""
#: notebook/notebookapp.py:389
msgid "List currently running notebook servers."
msgstr ""
#: notebook/notebookapp.py:393
msgid "Produce machine-readable JSON output."
msgstr ""
#: notebook/notebookapp.py:397
msgid "If True, each line of output will be a JSON object with the details from the server info file."
msgstr ""
#: notebook/notebookapp.py:402
msgid "Currently running servers:"
msgstr ""
#: notebook/notebookapp.py:419
msgid "Don't open the notebook in a browser after startup."
msgstr ""
#: notebook/notebookapp.py:423
msgid "DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib."
msgstr ""
#: notebook/notebookapp.py:439
msgid "Allow the notebook to be run from root user."
msgstr ""
#: notebook/notebookapp.py:470
msgid ""
"The Jupyter HTML Notebook.\n"
" \n"
" This launches a Tornado based HTML Notebook Server that serves up an HTML5/Javascript Notebook client."
msgstr ""
#: notebook/notebookapp.py:509
msgid "Deprecated: Use minified JS file or not, mainly use during dev to avoid JS recompilation"
msgstr ""
#: notebook/notebookapp.py:540
msgid "Set the Access-Control-Allow-Credentials: true header"
msgstr ""
#: notebook/notebookapp.py:544
msgid "Whether to allow the user to run the notebook as root."
msgstr ""
#: notebook/notebookapp.py:548
msgid "The default URL to redirect to from `/`"
msgstr ""
#: notebook/notebookapp.py:552
msgid "The IP address the notebook server will listen on."
msgstr ""
#: notebook/notebookapp.py:565
#, python-format
msgid ""
"Cannot bind to localhost, using 127.0.0.1 as default ip\n"
"%s"
msgstr ""
#: notebook/notebookapp.py:579
msgid "The port the notebook server will listen on."
msgstr ""
#: notebook/notebookapp.py:583
msgid "The number of additional ports to try if the specified port is not available."
msgstr ""
#: notebook/notebookapp.py:587
msgid "The full path to an SSL/TLS certificate file."
msgstr ""
#: notebook/notebookapp.py:591
msgid "The full path to a private key file for usage with SSL/TLS."
msgstr ""
#: notebook/notebookapp.py:595
msgid "The full path to a certificate authority certificate for SSL/TLS client authentication."
msgstr ""
#: notebook/notebookapp.py:599
msgid "The file where the cookie secret is stored."
msgstr ""
#: notebook/notebookapp.py:628
#, python-format
msgid "Writing notebook server cookie secret to %s"
msgstr ""
#: notebook/notebookapp.py:635
#, python-format
msgid "Could not set permissions on %s"
msgstr ""
#: notebook/notebookapp.py:640
msgid ""
"Token used for authenticating first-time connections to the server.\n"
"\n"
" When no password is enabled,\n"
" the default is to generate a new, random token.\n"
"\n"
" Setting to an empty string disables authentication altogether, which is NOT RECOMMENDED.\n"
" "
msgstr ""
#: notebook/notebookapp.py:650
msgid ""
"One-time token used for opening a browser.\n"
" Once used, this token cannot be used again.\n"
" "
msgstr ""
#: notebook/notebookapp.py:726
msgid ""
"Specify Where to open the notebook on startup. This is the\n"
" `new` argument passed to the standard library method `webbrowser.open`.\n"
" The behaviour is not guaranteed, but depends on browser support. Valid\n"
" values are:\n"
" 2 opens a new tab,\n"
" 1 opens a new window,\n"
" 0 opens in an existing window.\n"
" See the `webbrowser.open` documentation for details.\n"
" "
msgstr ""
#: notebook/notebookapp.py:737
msgid "DEPRECATED, use tornado_settings"
msgstr ""
#: notebook/notebookapp.py:742
msgid ""
"\n"
" webapp_settings is deprecated, use tornado_settings.\n"
msgstr ""
#: notebook/notebookapp.py:746
msgid "Supply overrides for the tornado.web.Application that the Jupyter notebook uses."
msgstr ""
#: notebook/notebookapp.py:750
msgid ""
"\n"
" Set the tornado compression options for websocket connections.\n"
"\n"
" This value will be returned from :meth:`WebSocketHandler.get_compression_options`.\n"
" None (default) will disable compression.\n"
" A dict (even an empty one) will enable compression.\n"
"\n"
" See the tornado docs for WebSocketHandler.get_compression_options for details.\n"
" "
msgstr ""
#: notebook/notebookapp.py:761
msgid "Supply overrides for terminado. Currently only supports \"shell_command\"."
msgstr ""
#: notebook/notebookapp.py:764
msgid "Extra keyword arguments to pass to `set_secure_cookie`. See tornado's set_secure_cookie docs for details."
msgstr ""
#: notebook/notebookapp.py:768
msgid ""
"Supply SSL options for the tornado HTTPServer.\n"
" See the tornado docs for details."
msgstr ""
#: notebook/notebookapp.py:772
msgid "Supply extra arguments that will be passed to Jinja environment."
msgstr ""
#: notebook/notebookapp.py:776
msgid "Extra variables to supply to jinja templates when rendering."
msgstr ""
#: notebook/notebookapp.py:812
msgid "DEPRECATED use base_url"
msgstr ""
#: notebook/notebookapp.py:816
msgid "base_project_url is deprecated, use base_url"
msgstr ""
#: notebook/notebookapp.py:832
msgid "Path to search for custom.js, css"
msgstr ""
#: notebook/notebookapp.py:844
msgid ""
"Extra paths to search for serving jinja templates.\n"
"\n"
" Can be used to override templates from notebook.templates."
msgstr ""
#: notebook/notebookapp.py:855
msgid "extra paths to look for Javascript notebook extensions"
msgstr ""
#: notebook/notebookapp.py:900
#, python-format
msgid "Using MathJax: %s"
msgstr ""
#: notebook/notebookapp.py:903
msgid "The MathJax.js configuration file that is to be used."
msgstr ""
#: notebook/notebookapp.py:908
#, python-format
msgid "Using MathJax configuration file: %s"
msgstr ""
#: notebook/notebookapp.py:914
msgid "The notebook manager class to use."
msgstr ""
#: notebook/notebookapp.py:920
msgid "The kernel manager class to use."
msgstr ""
#: notebook/notebookapp.py:926
msgid "The session manager class to use."
msgstr ""
#: notebook/notebookapp.py:932
msgid "The config manager class to use"
msgstr ""
#: notebook/notebookapp.py:953
msgid "The login handler class to use."
msgstr ""
#: notebook/notebookapp.py:960
msgid "The logout handler class to use."
msgstr ""
#: notebook/notebookapp.py:964
msgid "Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-For headerssent by the upstream reverse proxy. Necessary if the proxy handles SSL"
msgstr ""
#: notebook/notebookapp.py:976
msgid ""
"\n"
" DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.\n"
" "
msgstr ""
#: notebook/notebookapp.py:988
msgid "Support for specifying --pylab on the command line has been removed."
msgstr ""
#: notebook/notebookapp.py:990
msgid "Please use `%pylab{0}` or `%matplotlib{0}` in the notebook itself."
msgstr ""
#: notebook/notebookapp.py:995
msgid "The directory to use for notebooks and kernels."
msgstr ""
#: notebook/notebookapp.py:1018
#, python-format
msgid "No such notebook dir: '%r'"
msgstr ""
#: notebook/notebookapp.py:1031
msgid "DEPRECATED use the nbserver_extensions dict instead"
msgstr ""
#: notebook/notebookapp.py:1036
msgid "server_extensions is deprecated, use nbserver_extensions"
msgstr ""
#: notebook/notebookapp.py:1040
msgid "Dict of Python modules to load as notebook server extensions.Entry values can be used to enable and disable the loading ofthe extensions. The extensions will be loaded in alphabetical order."
msgstr ""
#: notebook/notebookapp.py:1049
msgid "Reraise exceptions encountered loading server extensions?"
msgstr ""
#: notebook/notebookapp.py:1052
msgid ""
"(msgs/sec)\n"
" Maximum rate at which messages can be sent on iopub before they are\n"
" limited."
msgstr ""
#: notebook/notebookapp.py:1056
msgid ""
"(bytes/sec)\n"
" Maximum rate at which stream output can be sent on iopub before they are\n"
" limited."
msgstr ""
#: notebook/notebookapp.py:1060
msgid ""
"(sec) Time window used to \n"
" check the message and data rate limits."
msgstr ""
#: notebook/notebookapp.py:1071
#, python-format
msgid "No such file or directory: %s"
msgstr ""
#: notebook/notebookapp.py:1141
msgid "Notebook servers are configured to only be run with a password."
msgstr ""
#: notebook/notebookapp.py:1142
msgid "Hint: run the following command to set a password"
msgstr ""
#: notebook/notebookapp.py:1143
msgid "\t$ python -m notebook.auth password"
msgstr ""
#: notebook/notebookapp.py:1181
#, python-format
msgid "The port %i is already in use, trying another port."
msgstr ""
#: notebook/notebookapp.py:1184
#, python-format
msgid "Permission to listen on port %i denied"
msgstr ""
#: notebook/notebookapp.py:1193
msgid "ERROR: the notebook server could not be started because no available port could be found."
msgstr ""
#: notebook/notebookapp.py:1199
msgid "[all ip addresses on your system]"
msgstr ""
#: notebook/notebookapp.py:1223
#, python-format
msgid "Terminals not available (error was %s)"
msgstr ""
#: notebook/notebookapp.py:1259
msgid "interrupted"
msgstr ""
#: notebook/notebookapp.py:1261
msgid "y"
msgstr ""
#: notebook/notebookapp.py:1262
msgid "n"
msgstr ""
#: notebook/notebookapp.py:1263
#, python-format
msgid "Shutdown this notebook server (%s/[%s])? "
msgstr ""
#: notebook/notebookapp.py:1269
msgid "Shutdown confirmed"
msgstr ""
#: notebook/notebookapp.py:1273
msgid "No answer for 5s:"
msgstr ""
#: notebook/notebookapp.py:1274
msgid "resuming operation..."
msgstr ""
#: notebook/notebookapp.py:1282
#, python-format
msgid "received signal %s, stopping"
msgstr ""
#: notebook/notebookapp.py:1338
#, python-format
msgid "Error loading server extension %s"
msgstr ""
#: notebook/notebookapp.py:1369
#, python-format
msgid "Shutting down %d kernels"
msgstr ""
#: notebook/notebookapp.py:1375
#, python-format
msgid "%d active kernel"
msgid_plural "%d active kernels"
msgstr[0] ""
msgstr[1] ""
#: notebook/notebookapp.py:1379
#, python-format
msgid ""
"The Jupyter Notebook is running at:\n"
"\r"
"%s"
msgstr ""
#: notebook/notebookapp.py:1426
msgid "Running as root is not recommended. Use --allow-root to bypass."
msgstr ""
#: notebook/notebookapp.py:1432
msgid "Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)."
msgstr ""
#: notebook/notebookapp.py:1434
msgid "Welcome to Project Jupyter! Explore the various tools available and their corresponding documentation. If you are interested in contributing to the platform, please visit the communityresources section at http://jupyter.org/community.html."
msgstr ""
#: notebook/notebookapp.py:1445
#, python-format
msgid "No web browser found: %s."
msgstr ""
#: notebook/notebookapp.py:1450
#, python-format
msgid "%s does not exist"
msgstr ""
#: notebook/notebookapp.py:1484
msgid "Interrupted..."
msgstr ""
#: notebook/services/contents/filemanager.py:506
#, python-format
msgid "Serving notebooks from local directory: %s"
msgstr ""
#: notebook/services/contents/manager.py:68
msgid "Untitled"
msgstr ""

@ -10,6 +10,7 @@ import notebook
import binascii
import datetime
import errno
import gettext
import importlib
import io
import json
@ -34,23 +35,28 @@ except ImportError: #PY2
from jinja2 import Environment, FileSystemLoader
# Set up message catalog access
base_dir = os.path.realpath(os.path.join(__file__, '..', '..'))
trans = gettext.translation('notebook', localedir=os.path.join(base_dir, 'notebook/i18n'), fallback=True)
trans.install()
_ = trans.gettext
# Install the pyzmq ioloop. This has to be done before anything else from
# tornado is imported.
from zmq.eventloop import ioloop
ioloop.install()
# check for tornado 3.1.0
msg = "The Jupyter Notebook requires tornado >= 4.0"
try:
import tornado
except ImportError:
raise ImportError(msg)
raise ImportError(_("The Jupyter Notebook requires tornado >= 4.0"))
try:
version_info = tornado.version_info
except AttributeError:
raise ImportError(msg + ", but you have < 1.1.0")
raise ImportError(_("The Jupyter Notebook requires tornado >= 4.0, but you have < 1.1.0"))
if version_info < (4,0):
raise ImportError(msg + ", but you have %s" % tornado.version)
raise ImportError(_("The Jupyter Notebook requires tornado >= 4.0, but you have %s") % tornado.version)
from tornado import httpserver
from tornado import web
@ -113,15 +119,6 @@ jupyter notebook --certfile=mycert.pem # use SSL/TLS certificate
jupyter notebook password # enter a password to protect the server
"""
DEV_NOTE_NPM = """It looks like you're running the notebook from source.
If you're working on the Javascript of the notebook, try running
npm run build:watch
in another terminal window to have the system incrementally
watch and build the notebook's JavaScript for you, as you make changes.
"""
#-----------------------------------------------------------------------------
# Helper functions
#-----------------------------------------------------------------------------
@ -154,17 +151,11 @@ class NotebookWebApplication(web.Application):
config_manager, log,
base_url, default_url, settings_overrides, jinja_env_options):
# If the user is running the notebook in a git directory, make the assumption
# that this is a dev install and suggest to the developer `npm run build:watch`.
base_dir = os.path.realpath(os.path.join(__file__, '..', '..'))
dev_mode = os.path.exists(os.path.join(base_dir, '.git'))
if dev_mode:
log.info(DEV_NOTE_NPM)
settings = self.init_settings(
jupyter_app, kernel_manager, contents_manager,
session_manager, kernel_spec_manager, config_manager, log, base_url,
default_url, settings_overrides, jinja_env_options)
session_manager, kernel_spec_manager, config_manager, log,
base_url, default_url, settings_overrides, jinja_env_options)
handlers = self.init_handlers(settings)
super(NotebookWebApplication, self).__init__(handlers, **settings)
@ -186,9 +177,27 @@ class NotebookWebApplication(web.Application):
jenv_opt = {"autoescape": True}
jenv_opt.update(jinja_env_options if jinja_env_options else {})
env = Environment(loader=FileSystemLoader(template_path), **jenv_opt)
env = Environment(loader=FileSystemLoader(template_path), extensions=['jinja2.ext.i18n'], **jenv_opt)
sys_info = get_sys_info()
# If the user is running the notebook in a git directory, make the assumption
# that this is a dev install and suggest to the developer `npm run build:watch`.
base_dir = os.path.realpath(os.path.join(__file__, '..', '..'))
dev_mode = os.path.exists(os.path.join(base_dir, '.git'))
nbui = gettext.translation('nbui', localedir=os.path.join(base_dir, 'notebook/i18n'), fallback=True)
env.install_gettext_translations(nbui, newstyle=False)
if dev_mode:
DEV_NOTE_NPM = """It looks like you're running the notebook from source.
If you're working on the Javascript of the notebook, try running
%s
in another terminal window to have the system incrementally
watch and build the notebook's JavaScript for you, as you make changes.""" % 'npm run build:watch'
log.info(DEV_NOTE_NPM)
if sys_info['commit_source'] == 'repository':
# don't cache (rely on 304) when working from master
version_hash = ''
@ -197,10 +206,9 @@ class NotebookWebApplication(web.Application):
version_hash = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
if jupyter_app.ignore_minified_js:
log.warning("""The `ignore_minified_js` flag is deprecated and no
longer works. Alternatively use `npm run build:watch` when
working on the notebook's Javascript and LESS""")
warnings.warn("The `ignore_minified_js` flag is deprecated and will be removed in Notebook 6.0", DeprecationWarning)
log.warning(_("""The `ignore_minified_js` flag is deprecated and no longer works."""))
log.warning(_("""Alternatively use `%s` when working on the notebook's Javascript and LESS""") % 'npm run build:watch')
warnings.warn(_("The `ignore_minified_js` flag is deprecated and will be removed in Notebook 6.0"), DeprecationWarning)
now = utcnow()
@ -378,20 +386,20 @@ class NbserverStopApp(JupyterApp):
class NbserverListApp(JupyterApp):
version = __version__
description="List currently running notebook servers."
description=_("List currently running notebook servers.")
flags = dict(
json=({'NbserverListApp': {'json': True}},
"Produce machine-readable JSON output."),
_("Produce machine-readable JSON output.")),
)
json = Bool(False, config=True,
help="If True, each line of output will be a JSON object with the "
"details from the server info file.")
help=_("If True, each line of output will be a JSON object with the "
"details from the server info file."))
def start(self):
if not self.json:
print("Currently running servers:")
print(_("Currently running servers:"))
for serverinfo in list_running_servers(self.runtime_dir):
if self.json:
print(json.dumps(serverinfo))
@ -408,11 +416,11 @@ class NbserverListApp(JupyterApp):
flags = dict(base_flags)
flags['no-browser']=(
{'NotebookApp' : {'open_browser' : False}},
"Don't open the notebook in a browser after startup."
_("Don't open the notebook in a browser after startup.")
)
flags['pylab']=(
{'NotebookApp' : {'pylab' : 'warn'}},
"DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib."
_("DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.")
)
flags['no-mathjax']=(
{'NotebookApp' : {'enable_mathjax' : False}},
@ -428,7 +436,7 @@ flags['no-mathjax']=(
flags['allow-root']=(
{'NotebookApp' : {'allow_root' : True}},
"Allow the notebook to be run from root user."
_("Allow the notebook to be run from root user.")
)
# Add notebook manager flags
@ -459,12 +467,9 @@ class NotebookApp(JupyterApp):
name = 'jupyter-notebook'
version = __version__
description = """
The Jupyter HTML Notebook.
This launches a Tornado based HTML Notebook Server that serves up an
HTML5/Javascript Notebook client.
"""
description = _("""The Jupyter HTML Notebook.
This launches a Tornado based HTML Notebook Server that serves up an HTML5/Javascript Notebook client.""")
examples = _examples
aliases = aliases
flags = flags
@ -501,7 +506,7 @@ class NotebookApp(JupyterApp):
ignore_minified_js = Bool(False,
config=True,
help='Deprecated: Use minified JS file or not, mainly use during dev to avoid JS recompilation',
help=_('Deprecated: Use minified JS file or not, mainly use during dev to avoid JS recompilation'),
)
# file to be opened in the notebook server
@ -532,19 +537,19 @@ class NotebookApp(JupyterApp):
)
allow_credentials = Bool(False, config=True,
help="Set the Access-Control-Allow-Credentials: true header"
help=_("Set the Access-Control-Allow-Credentials: true header")
)
allow_root = Bool(False, config=True,
help="Whether to allow the user to run the notebook as root."
help=_("Whether to allow the user to run the notebook as root.")
)
default_url = Unicode('/tree', config=True,
help="The default URL to redirect to from `/`"
help=_("The default URL to redirect to from `/`")
)
ip = Unicode('localhost', config=True,
help="The IP address the notebook server will listen on."
help=_("The IP address the notebook server will listen on.")
)
@default('ip')
@ -557,7 +562,7 @@ class NotebookApp(JupyterApp):
try:
s.bind(('localhost', 0))
except socket.error as e:
self.log.warning("Cannot bind to localhost, using 127.0.0.1 as default ip\n%s", e)
self.log.warning(_("Cannot bind to localhost, using 127.0.0.1 as default ip\n%s"), e)
return '127.0.0.1'
else:
s.close()
@ -571,27 +576,27 @@ class NotebookApp(JupyterApp):
return value
port = Integer(8888, config=True,
help="The port the notebook server will listen on."
help=_("The port the notebook server will listen on.")
)
port_retries = Integer(50, config=True,
help="The number of additional ports to try if the specified port is not available."
help=_("The number of additional ports to try if the specified port is not available.")
)
certfile = Unicode(u'', config=True,
help="""The full path to an SSL/TLS certificate file."""
help=_("""The full path to an SSL/TLS certificate file.""")
)
keyfile = Unicode(u'', config=True,
help="""The full path to a private key file for usage with SSL/TLS."""
help=_("""The full path to a private key file for usage with SSL/TLS.""")
)
client_ca = Unicode(u'', config=True,
help="""The full path to a certificate authority certificate for SSL/TLS client authentication."""
help=_("""The full path to a certificate authority certificate for SSL/TLS client authentication.""")
)
cookie_secret_file = Unicode(config=True,
help="""The file where the cookie secret is stored."""
help=_("""The file where the cookie secret is stored.""")
)
@default('cookie_secret_file')
@ -620,32 +625,31 @@ class NotebookApp(JupyterApp):
def _write_cookie_secret_file(self, secret):
"""write my secret to my secret_file"""
self.log.info("Writing notebook server cookie secret to %s", self.cookie_secret_file)
self.log.info(_("Writing notebook server cookie secret to %s"), self.cookie_secret_file)
with io.open(self.cookie_secret_file, 'wb') as f:
f.write(secret)
try:
os.chmod(self.cookie_secret_file, 0o600)
except OSError:
self.log.warning(
"Could not set permissions on %s",
_("Could not set permissions on %s"),
self.cookie_secret_file
)
token = Unicode('<generated>',
help="""Token used for authenticating first-time connections to the server.
help=_("""Token used for authenticating first-time connections to the server.
When no password is enabled,
the default is to generate a new, random token.
Setting to an empty string disables authentication altogether, which is NOT RECOMMENDED.
"""
""")
).tag(config=True)
one_time_token = Unicode(
help="""One-time token used for opening a browser.
help=_("""One-time token used for opening a browser.
Once used, this token cannot be used again.
"""
""")
)
_token_generated = True
@ -719,7 +723,7 @@ class NotebookApp(JupyterApp):
""")
webbrowser_open_new = Integer(2, config=True,
help="""Specify Where to open the notebook on startup. This is the
help=_("""Specify Where to open the notebook on startup. This is the
`new` argument passed to the standard library method `webbrowser.open`.
The behaviour is not guaranteed, but depends on browser support. Valid
values are:
@ -727,23 +731,23 @@ class NotebookApp(JupyterApp):
1 opens a new window,
0 opens in an existing window.
See the `webbrowser.open` documentation for details.
""")
"""))
webapp_settings = Dict(config=True,
help="DEPRECATED, use tornado_settings"
help=_("DEPRECATED, use tornado_settings")
)
@observe('webapp_settings')
def _update_webapp_settings(self, change):
self.log.warning("\n webapp_settings is deprecated, use tornado_settings.\n")
self.log.warning(_("\n webapp_settings is deprecated, use tornado_settings.\n"))
self.tornado_settings = change['new']
tornado_settings = Dict(config=True,
help="Supply overrides for the tornado.web.Application that the "
"Jupyter notebook uses.")
help=_("Supply overrides for the tornado.web.Application that the "
"Jupyter notebook uses."))
websocket_compression_options = Any(None, config=True,
help="""
help=_("""
Set the tornado compression options for websocket connections.
This value will be returned from :meth:`WebSocketHandler.get_compression_options`.
@ -751,25 +755,25 @@ class NotebookApp(JupyterApp):
A dict (even an empty one) will enable compression.
See the tornado docs for WebSocketHandler.get_compression_options for details.
"""
""")
)
terminado_settings = Dict(config=True,
help='Supply overrides for terminado. Currently only supports "shell_command".')
help=_('Supply overrides for terminado. Currently only supports "shell_command".'))
cookie_options = Dict(config=True,
help="Extra keyword arguments to pass to `set_secure_cookie`."
" See tornado's set_secure_cookie docs for details."
help=_("Extra keyword arguments to pass to `set_secure_cookie`."
" See tornado's set_secure_cookie docs for details.")
)
ssl_options = Dict(config=True,
help="""Supply SSL options for the tornado HTTPServer.
See the tornado docs for details.""")
help=_("""Supply SSL options for the tornado HTTPServer.
See the tornado docs for details."""))
jinja_environment_options = Dict(config=True,
help="Supply extra arguments that will be passed to Jinja environment.")
help=_("Supply extra arguments that will be passed to Jinja environment."))
jinja_template_vars = Dict(
config=True,
help="Extra variables to supply to jinja templates when rendering.",
help=_("Extra variables to supply to jinja templates when rendering."),
)
enable_mathjax = Bool(True, config=True,
@ -805,11 +809,11 @@ class NotebookApp(JupyterApp):
value = value + '/'
return value
base_project_url = Unicode('/', config=True, help="""DEPRECATED use base_url""")
base_project_url = Unicode('/', config=True, help=_("""DEPRECATED use base_url"""))
@observe('base_project_url')
def _update_base_project_url(self, change):
self.log.warning("base_project_url is deprecated, use base_url")
self.log.warning(_("base_project_url is deprecated, use base_url"))
self.base_url = change['new']
extra_static_paths = List(Unicode(), config=True,
@ -825,7 +829,7 @@ class NotebookApp(JupyterApp):
return self.extra_static_paths + [DEFAULT_STATIC_FILES_PATH]
static_custom_path = List(Unicode(),
help="""Path to search for custom.js, css"""
help=_("""Path to search for custom.js, css""")
)
@default('static_custom_path')
@ -837,9 +841,9 @@ class NotebookApp(JupyterApp):
]
extra_template_paths = List(Unicode(), config=True,
help="""Extra paths to search for serving jinja templates.
help=_("""Extra paths to search for serving jinja templates.
Can be used to override templates from notebook.templates."""
Can be used to override templates from notebook.templates.""")
)
@property
@ -848,7 +852,7 @@ class NotebookApp(JupyterApp):
return self.extra_template_paths + DEFAULT_TEMPLATE_PATH_LIST
extra_nbextensions_path = List(Unicode(), config=True,
help="""extra paths to look for Javascript notebook extensions"""
help=_("""extra paths to look for Javascript notebook extensions""")
)
@property
@ -893,39 +897,39 @@ class NotebookApp(JupyterApp):
# enable_mathjax=False overrides mathjax_url
self.mathjax_url = u''
else:
self.log.info("Using MathJax: %s", new)
self.log.info(_("Using MathJax: %s"), new)
mathjax_config = Unicode("TeX-AMS-MML_HTMLorMML-full,Safe", config=True,
help="""The MathJax.js configuration file that is to be used."""
help=_("""The MathJax.js configuration file that is to be used.""")
)
@observe('mathjax_config')
def _update_mathjax_config(self, change):
self.log.info("Using MathJax configuration file: %s", change['new'])
self.log.info(_("Using MathJax configuration file: %s"), change['new'])
contents_manager_class = Type(
default_value=LargeFileManager,
klass=ContentsManager,
config=True,
help='The notebook manager class to use.'
help=_('The notebook manager class to use.')
)
kernel_manager_class = Type(
default_value=MappingKernelManager,
config=True,
help='The kernel manager class to use.'
help=_('The kernel manager class to use.')
)
session_manager_class = Type(
default_value=SessionManager,
config=True,
help='The session manager class to use.'
help=_('The session manager class to use.')
)
config_manager_class = Type(
default_value=ConfigManager,
config = True,
help='The config manager class to use'
help=_('The config manager class to use')
)
kernel_spec_manager = Instance(KernelSpecManager, allow_none=True)
@ -946,19 +950,19 @@ class NotebookApp(JupyterApp):
default_value=LoginHandler,
klass=web.RequestHandler,
config=True,
help='The login handler class to use.',
help=_('The login handler class to use.'),
)
logout_handler_class = Type(
default_value=LogoutHandler,
klass=web.RequestHandler,
config=True,
help='The logout handler class to use.',
help=_('The logout handler class to use.'),
)
trust_xheaders = Bool(False, config=True,
help=("Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-For headers"
"sent by the upstream reverse proxy. Necessary if the proxy handles SSL")
help=(_("Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded-For headers"
"sent by the upstream reverse proxy. Necessary if the proxy handles SSL"))
)
info_file = Unicode()
@ -969,9 +973,9 @@ class NotebookApp(JupyterApp):
return os.path.join(self.runtime_dir, info_file)
pylab = Unicode('disabled', config=True,
help="""
help=_("""
DISABLED: use %pylab or %matplotlib in the notebook to enable matplotlib.
"""
""")
)
@observe('pylab')
@ -981,14 +985,14 @@ class NotebookApp(JupyterApp):
backend = ' %s' % change['new']
else:
backend = ''
self.log.error("Support for specifying --pylab on the command line has been removed.")
self.log.error(_("Support for specifying --pylab on the command line has been removed."))
self.log.error(
"Please use `%pylab{0}` or `%matplotlib{0}` in the notebook itself.".format(backend)
_("Please use `%pylab{0}` or `%matplotlib{0}` in the notebook itself.").format(backend)
)
self.exit(1)
notebook_dir = Unicode(config=True,
help="The directory to use for notebooks and kernels."
help=_("The directory to use for notebooks and kernels.")
)
@default('notebook_dir')
@ -1011,7 +1015,7 @@ class NotebookApp(JupyterApp):
# If we receive a non-absolute path, make it absolute.
value = os.path.abspath(value)
if not os.path.isdir(value):
raise TraitError("No such notebook dir: %r" % value)
raise TraitError(trans.gettext("No such notebook dir: '%r'") % value)
return value
@observe('notebook_dir')
@ -1024,37 +1028,37 @@ class NotebookApp(JupyterApp):
# TODO: Remove me in notebook 5.0
server_extensions = List(Unicode(), config=True,
help=("DEPRECATED use the nbserver_extensions dict instead")
help=(_("DEPRECATED use the nbserver_extensions dict instead"))
)
@observe('server_extensions')
def _update_server_extensions(self, change):
self.log.warning("server_extensions is deprecated, use nbserver_extensions")
self.log.warning(_("server_extensions is deprecated, use nbserver_extensions"))
self.server_extensions = change['new']
nbserver_extensions = Dict({}, config=True,
help=("Dict of Python modules to load as notebook server extensions."
help=(_("Dict of Python modules to load as notebook server extensions."
"Entry values can be used to enable and disable the loading of"
"the extensions. The extensions will be loaded in alphabetical "
"order.")
"order."))
)
reraise_server_extension_failures = Bool(
False,
config=True,
help="Reraise exceptions encountered loading server extensions?",
help=_("Reraise exceptions encountered loading server extensions?"),
)
iopub_msg_rate_limit = Float(1000, config=True, help="""(msgs/sec)
iopub_msg_rate_limit = Float(1000, config=True, help=_("""(msgs/sec)
Maximum rate at which messages can be sent on iopub before they are
limited.""")
limited."""))
iopub_data_rate_limit = Float(1000000, config=True, help="""(bytes/sec)
iopub_data_rate_limit = Float(1000000, config=True, help=_("""(bytes/sec)
Maximum rate at which stream output can be sent on iopub before they are
limited.""")
limited."""))
rate_limit_window = Float(3, config=True, help="""(sec) Time window used to
check the message and data rate limits.""")
rate_limit_window = Float(3, config=True, help=_("""(sec) Time window used to
check the message and data rate limits."""))
def parse_command_line(self, argv=None):
super(NotebookApp, self).parse_command_line(argv)
@ -1064,7 +1068,7 @@ class NotebookApp(JupyterApp):
f = os.path.abspath(arg0)
self.argv.remove(arg0)
if not os.path.exists(f):
self.log.critical("No such file or directory: %s", f)
self.log.critical(_("No such file or directory: %s"), f)
self.exit(1)
# Use config here, to ensure that it takes higher priority than
@ -1134,9 +1138,9 @@ class NotebookApp(JupyterApp):
self.default_url = url_path_join(self.base_url, self.default_url)
if self.password_required and (not self.password):
self.log.critical("Notebook servers are configured to only be run with a password.")
self.log.critical("Hint: run the following command to set a password")
self.log.critical("\t$ python -m notebook.auth password")
self.log.critical(_("Notebook servers are configured to only be run with a password."))
self.log.critical(_("Hint: run the following command to set a password"))
self.log.critical(_("\t$ python -m notebook.auth password"))
sys.exit(1)
self.web_app = NotebookWebApplication(
@ -1174,10 +1178,10 @@ class NotebookApp(JupyterApp):
self.http_server.listen(port, self.ip)
except socket.error as e:
if e.errno == errno.EADDRINUSE:
self.log.info('The port %i is already in use, trying another port.' % port)
self.log.info(_('The port %i is already in use, trying another port.') % port)
continue
elif e.errno in (errno.EACCES, getattr(errno, 'WSAEACCES', errno.EACCES)):
self.log.warning("Permission to listen on port %i denied" % port)
self.log.warning(_("Permission to listen on port %i denied") % port)
continue
else:
raise
@ -1186,13 +1190,13 @@ class NotebookApp(JupyterApp):
success = True
break
if not success:
self.log.critical('ERROR: the notebook server could not be started because '
'no available port could be found.')
self.log.critical(_('ERROR: the notebook server could not be started because '
'no available port could be found.'))
self.exit(1)
@property
def display_url(self):
ip = self.ip if self.ip else '[all ip addresses on your system]'
ip = self.ip if self.ip else _('[all ip addresses on your system]')
url = self._url(ip)
if self.token:
# Don't log full token if it came from config
@ -1216,7 +1220,7 @@ class NotebookApp(JupyterApp):
self.web_app.settings['terminals_available'] = True
except ImportError as e:
log = self.log.debug if sys.platform == 'win32' else self.log.warning
log("Terminals not available (error was %s)", e)
log(_("Terminals not available (error was %s)"), e)
def init_signal(self):
if not sys.platform.startswith('win') and sys.stdin and sys.stdin.isatty():
@ -1252,20 +1256,22 @@ class NotebookApp(JupyterApp):
This doesn't work on Windows.
"""
info = self.log.info
info('interrupted')
info(_('interrupted'))
print(self.notebook_info())
sys.stdout.write("Shutdown this notebook server (y/[n])? ")
yes = _('y')
no = _('n')
sys.stdout.write(_("Shutdown this notebook server (%s/[%s])? ") % (yes, no))
sys.stdout.flush()
r,w,x = select.select([sys.stdin], [], [], 5)
if r:
line = sys.stdin.readline()
if line.lower().startswith('y') and 'n' not in line.lower():
self.log.critical("Shutdown confirmed")
if line.lower().startswith(yes) and no not in line.lower():
self.log.critical(_("Shutdown confirmed"))
ioloop.IOLoop.current().stop()
return
else:
print("No answer for 5s:", end=' ')
print("resuming operation...")
print(_("No answer for 5s:"), end=' ')
print(_("resuming operation..."))
# no answer, or answer is no:
# set it back to original SIGINT handler
# use IOLoop.add_callback because signal.signal must be called
@ -1273,7 +1279,7 @@ class NotebookApp(JupyterApp):
ioloop.IOLoop.current().add_callback(self._restore_sigint_handler)
def _signal_stop(self, sig, frame):
self.log.critical("received signal %s, stopping", sig)
self.log.critical(_("received signal %s, stopping"), sig)
ioloop.IOLoop.current().stop()
def _signal_info(self, sig, frame):
@ -1329,7 +1335,7 @@ class NotebookApp(JupyterApp):
except Exception:
if self.reraise_server_extension_failures:
raise
self.log.warning("Error loading server extension %s", modulename,
self.log.warning(_("Error loading server extension %s"), modulename,
exc_info=True)
def init_mime_overrides(self):
@ -1359,16 +1365,21 @@ class NotebookApp(JupyterApp):
The kernels will shutdown themselves when this process no longer exists,
but explicit shutdown allows the KernelManagers to cleanup the connection files.
"""
self.log.info('Shutting down %d kernels',
len(self.kernel_manager.list_kernel_ids()))
n_kernels = len(self.kernel_manager.list_kernel_ids())
kernel_msg = trans.ngettext('Shutting down %d kernel', 'Shutting down %d kernels', n_kernels)
self.log.info(kernel_msg % n_kernels)
self.kernel_manager.shutdown_all()
def notebook_info(self):
"Return the current working directory and the server url information"
info = self.contents_manager.info_string() + "\n"
info += "%d active kernels \n" % len(self.kernel_manager._kernels)
n_kernels = len(self.kernel_manager.list_kernel_ids())
kernel_msg = trans.ngettext("%d active kernel", "%d active kernels", n_kernels)
info += kernel_msg % n_kernels
info += "\n"
# Format the info so that the URL fits on a single line in 80 char display
return info + "The Jupyter Notebook is running at:\n\r%s" % self.display_url
info += _("The Jupyter Notebook is running at:\n%s") % self.display_url
return info
def server_info(self):
"""Return a JSONable dict of information about this server."""
@ -1414,18 +1425,18 @@ class NotebookApp(JupyterApp):
except AttributeError:
uid = -1 # anything nonzero here, since we can't check UID assume non-root
if uid == 0:
self.log.critical("Running as root is not recommended. Use --allow-root to bypass.")
self.log.critical(_("Running as root is not recommended. Use --allow-root to bypass."))
self.exit(1)
info = self.log.info
for line in self.notebook_info().split("\n"):
info(line)
info("Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).")
info(_("Use Control-C to stop this server and shut down all kernels (twice to skip confirmation)."))
if 'dev' in notebook.__version__:
info("Welcome to Project Jupyter! Explore the various tools available"
info(_("Welcome to Project Jupyter! Explore the various tools available"
" and their corresponding documentation. If you are interested"
" in contributing to the platform, please visit the community"
"resources section at http://jupyter.org/community.html.")
"resources section at http://jupyter.org/community.html."))
self.write_server_info_file()
@ -1433,12 +1444,12 @@ class NotebookApp(JupyterApp):
try:
browser = webbrowser.get(self.browser or None)
except webbrowser.Error as e:
self.log.warning('No web browser found: %s.' % e)
self.log.warning(_('No web browser found: %s.') % e)
browser = None
if self.file_to_run:
if not os.path.exists(self.file_to_run):
self.log.critical("%s does not exist" % self.file_to_run)
self.log.critical(_("%s does not exist") % self.file_to_run)
self.exit(1)
relpath = os.path.relpath(self.file_to_run, self.notebook_dir)
@ -1472,7 +1483,7 @@ class NotebookApp(JupyterApp):
try:
self.io_loop.start()
except KeyboardInterrupt:
info("Interrupted...")
info(_("Interrupted..."))
finally:
self.remove_server_info_file()
self.cleanup_kernels()

@ -514,7 +514,7 @@ class FileContentsManager(FileManagerMixin, ContentsManager):
raise web.HTTPError(500, u'Unknown error renaming file: %s %s' % (old_path, e))
def info_string(self):
return "Serving notebooks from local directory: %s" % self.root_dir
return _("Serving notebooks from local directory: %s") % self.root_dir
def get_kernel_path(self, path, model=None):
"""Return the initial API path of a kernel associated with a given notebook"""

@ -4,6 +4,7 @@
# Distributed under the terms of the Modified BSD License.
from fnmatch import fnmatch
import gettext
import itertools
import json
import os
@ -64,7 +65,7 @@ class ContentsManager(LoggingConfigurable):
Glob patterns to hide in file and directory listings.
""")
untitled_notebook = Unicode("Untitled", config=True,
untitled_notebook = Unicode(_("Untitled"), config=True,
help="The base name used when creating untitled notebooks."
)

@ -1,13 +1,13 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(function(require) {
define(['jquery',
'codemirror/lib/codemirror',
'bootstrap',
'base/js/i18n'],
function($, CodeMirror, bs, i18n) {
"use strict";
var CodeMirror = require('codemirror/lib/codemirror');
var bs = require('bootstrap');
var $ = require('jquery');
/**
* A wrapper around bootstrap modal for easier use
* Pass it an option dictionary with the following properties:
@ -86,7 +86,7 @@ define(function(require) {
var button = $("<button/>")
.addClass("btn btn-default btn-sm")
.attr("data-dismiss", "modal")
.text(label);
.text(i18n.msg.translate(label).fetch());
if (btn_opts.id) {
button.attr('id', btn_opts.id);
}
@ -157,18 +157,27 @@ define(function(require) {
var edit_metadata = function (options) {
options.name = options.name || "Cell";
var error_div = $('<div/>').css('color', 'red');
var message =
"Manually edit the JSON below to manipulate the metadata for this " + options.name + "." +
" We recommend putting custom metadata attributes in an appropriately named substructure," +
" so they don't conflict with those of others.";
var message_cell =
i18n.msg._("Manually edit the JSON below to manipulate the metadata for this cell.");
var message_notebook =
i18n.msg._("Manually edit the JSON below to manipulate the metadata for this notebook.");
var message_end =
i18n.msg._(" We recommend putting custom metadata attributes in an appropriately named substructure," +
" so they don't conflict with those of others.");
var message;
if (options.name === 'Notebook') {
message = message_notebook + message_end;
} else {
message = message_cell + message_end;
}
var textarea = $('<textarea/>')
.attr('rows', '13')
.attr('cols', '80')
.attr('name', 'metadata')
.text(JSON.stringify(options.md || {}, null, 2));
var dialogform = $('<div/>').attr('title', 'Edit the metadata')
var dialogform = $('<div/>').attr('title', i18n.msg._('Edit the metadata'))
.append(
$('<form/>').append(
$('<fieldset/>').append(
@ -188,8 +197,17 @@ define(function(require) {
autoIndent: true,
mode: 'application/json',
});
var title_msg;
if (options.name === "Notebook") {
title_msg = i18n.msg._("Edit Notebook Metadata");
} else {
title_msg = i18n.msg._("Edit Cell Metadata");
}
// This statement is used simply so that message extraction
// will pick up the strings.
var button_labels = [ i18n.msg._("Cancel"), i18n.msg._("Edit"), i18n.msg._("OK"), i18n.msg._("Apply")];
var modal_obj = modal({
title: "Edit " + options.name + " Metadata",
title: title_msg,
body: dialogform,
default_button: "Cancel",
buttons: {
@ -204,7 +222,7 @@ define(function(require) {
new_md = JSON.parse(editor.getValue());
} catch(e) {
console.log(e);
error_div.text('WARNING: Could not save invalid JSON.');
error_div.text(i18n.msg._('WARNING: Could not save invalid JSON.'));
return false;
}
options.callback(new_md);
@ -226,10 +244,10 @@ define(function(require) {
var message;
var attachments_list;
if (Object.keys(options.attachments).length == 0) {
message = "There are no attachments for this cell.";
message = i18n.msg._("There are no attachments for this cell.");
attachments_list = $('<div>');
} else {
message = "Current cell attachments";
message = i18n.msg._("Current cell attachments");
attachments_list = $('<div>')
.addClass('list_container')
@ -238,7 +256,7 @@ define(function(require) {
.addClass('row list_header')
.append(
$('<div>')
.text('Attachments')
.text(i18n.msg._('Attachments'))
)
);
@ -262,7 +280,7 @@ define(function(require) {
.addClass('btn btn-default btn-xs')
.css('display', 'inline-block');
if (deleted) {
btn.attr('title', 'Restore')
btn.attr('title', i18n.msg._('Restore'))
.append(
$('<i>')
.addClass('fa fa-plus')
@ -272,7 +290,7 @@ define(function(require) {
refresh_attachments_list();
});
} else {
btn.attr('title', 'Delete')
btn.attr('title', i18n.msg._('Delete'))
.addClass('btn-danger')
.append(
$('<i>')
@ -321,12 +339,18 @@ define(function(require) {
}
var dialogform = $('<div/>')
.attr('title', 'Edit attachments')
.attr('title', i18n.msg._('Edit attachments'))
.append(message)
.append('<br />')
.append(attachments_list)
.append(attachments_list);
var title_msg;
if ( options.name === "Notebook" ) {
title_msg = i18n.msg._("Edit Notebook Attachments");
} else {
title_msg = i18n.msg._("Edit Cell Attachments");
}
var modal_obj = modal({
title: "Edit " + options.name + " Attachments",
title: title_msg,
body: dialogform,
buttons: {
Apply: { class : "btn-primary",
@ -346,7 +370,7 @@ define(function(require) {
var insert_image = function (options) {
var message =
"Select a file to insert.";
i18n.msg._("Select a file to insert.");
var file_input = $('<input/>')
.attr('type', 'file')
.attr('accept', 'image/*')
@ -359,7 +383,7 @@ define(function(require) {
$btn.addClass('disabled');
}
});
var dialogform = $('<div/>').attr('title', 'Edit attachments')
var dialogform = $('<div/>').attr('title', i18n.msg._('Edit attachments'))
.append(
$('<form id="insert-image-form" />').append(
$('<fieldset/>').append(
@ -372,7 +396,7 @@ define(function(require) {
)
);
var modal_obj = modal({
title: "Pick a file",
title: i18n.msg._("Select a file"),
body: dialogform,
buttons: {
OK: {

@ -0,0 +1,54 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
// Module to handle i18n ( Internationalization ) and translated UI
define([
'jed',
'moment',
'json!../../../i18n/nbjs.json',
'base/js/i18nload',
], function(Jed, moment, nbjs, i18nload) {
"use strict";
// Setup language related stuff
var ui_lang = navigator.languages && navigator.languages[0] || // Chrome / Firefox
navigator.language || // All browsers
navigator.userLanguage; // IE <= 10
var init = function() {
var msg_promise;
if (nbjs.supported_languages.indexOf(ui_lang) >= 0) {
moment.locale(ui_lang);
msg_promise = new Promise( function (resolve, reject) {
require([i18nload.id+"!"+ui_lang], function (data) {
var newi18n = new Jed(data);
newi18n._ = newi18n.gettext;
resolve(newi18n);
}, function (error) {
console.log("Error loading translations for language: "+ui_lang);
var newi18n = new Jed(nbjs);
newi18n._ = newi18n.gettext;
resolve(newi18n);
});
});
} else {
msg_promise = new Promise( function (resolve, reject) {
var newi18n = new Jed(nbjs);
newi18n._ = newi18n.gettext;
resolve(newi18n);
});
}
return msg_promise;
}
var i18n = new Jed(nbjs);
i18n._ = i18n.gettext;
i18n.msg = i18n; // Just a place holder until the init promise resolves.
init().then(function (msg) {
i18n.msg = msg;
i18n.msg._ = i18n.msg.gettext;
});
return i18n;
});

@ -0,0 +1,26 @@
/**
* Plugin to load a single locale.
*/
define([
"require",
"module",
// These are only here so that the optimizer knows which ones we MIGHT load.
// We will actually only load the ones we need. There should be one entry
// here for each language you want to support.
// For example, for German....
// "json!base/../../i18n/de/LC_MESSAGES/nbjs.json"
], function (require, module) {
return {
id: module.id,
load: function (locale, callerRequire, onload, loaderConfig) {
var dependencies = "json!base/../../i18n/"+locale+"/LC_MESSAGES/nbjs.json";
// Load the JSON file requested
require([dependencies], function (data) {
onload(data);
});
}
};
});

@ -3,35 +3,39 @@
require([
'jquery',
'base/js/dialog',
'base/js/i18n',
'underscore',
'base/js/namespace'
], function ($, dialog, _, IPython) {
], function ($, dialog, i18n, _, IPython) {
'use strict';
$('#notebook_about').click(function () {
// use underscore template to auto html escape
if (sys_info) {
var text = 'You are using Jupyter notebook.<br/><br/>';
text = text + 'The version of the notebook server is ';
var text = i18n.msg._('You are using Jupyter notebook.');
text = text + '<br/><br/>';
text = text + i18n.msg._('The version of the notebook server is: ');
text = text + _.template('<b><%- version %></b>')({ version: sys_info.notebook_version });
if (sys_info.commit_hash) {
text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
}
text = text + _.template(' and is running on:<br/><pre>Python <%- pyver %></pre>')({
text = text + '<br/>';
text = text + i18n.msg._('The server is running on this version of Python:');
text = text + _.template('<br/><pre>Python <%- pyver %></pre>')({
pyver: sys_info.sys_version });
var kinfo = $('<div/>').attr('id', '#about-kinfo').text('Waiting for kernel to be available...');
var kinfo = $('<div/>').attr('id', '#about-kinfo').text(i18n.msg._('Waiting for kernel to be available...'));
var body = $('<div/>');
body.append($('<h4/>').text('Server Information:'));
body.append($('<h4/>').text(i18n.msg._('Server Information:')));
body.append($('<p/>').html(text));
body.append($('<h4/>').text('Current Kernel Information:'));
body.append($('<h4/>').text(i18n.msg._('Current Kernel Information:')));
body.append(kinfo);
} else {
var text = 'Could not access sys_info variable for version information.';
var text = i18n.msg._('Could not access sys_info variable for version information.');
var body = $('<div/>');
body.append($('<h4/>').text('Cannot find sys_info!'));
body.append($('<h4/>').text(i18n.msg._('Cannot find sys_info!')));
body.append($('<p/>').html(text));
}
dialog.modal({
title: 'About Jupyter Notebook',
title: i18n.msg._('About Jupyter Notebook'),
body: body,
buttons: { 'OK': {} }
});
@ -40,7 +44,7 @@ require([
kinfo.html($('<pre/>').text(data.content.banner));
});
} catch (e) {
kinfo.html($('<p/>').text('unable to contact kernel'));
kinfo.html($('<p/>').text(i18n.msg._('unable to contact kernel')));
}
});
});

@ -15,7 +15,9 @@
// * For dialogs, use a verb that indicates what the dialog will accomplish, such as "confirm-restart-kernel".
define(function(require){
define([
'base/js/i18n',
], function(i18n){
"use strict";
var warn_bad_name = function(name){
@ -64,13 +66,15 @@ define(function(require){
**/
var _actions = {
'toggle-rtl-layout': {
help: 'Open a dialog to edit the command mode keyboard shortcuts',
cmd: i18n.msg._('toggle rtl layout'),
help: i18n.msg._('Toggle the screen directionality between left-to-right and right-to-left'),
handler: function () {
(document.body.getAttribute('dir')=='rtl') ? document.body.setAttribute('dir','ltr') : document.body.setAttribute('dir','rtl');
}
},
'edit-command-mode-keyboard-shortcuts': {
help: 'Open a dialog to edit the command mode keyboard shortcuts',
cmd: i18n.msg._('edit command mode keyboard shortcuts'),
help: i18n.msg._('Open a dialog to edit the command mode keyboard shortcuts'),
handler: function (env) {
env.notebook.show_shortcuts_editor();
}
@ -90,7 +94,8 @@ define(function(require){
}
},
'restart-kernel': {
help: 'restart the kernel (no confirmation dialog)',
cmd: i18n.msg._('restart kernel'),
help: i18n.msg._('restart the kernel (no confirmation dialog)'),
handler: function (env) {
env.notebook.restart_kernel({confirm: false});
},
@ -98,131 +103,155 @@ define(function(require){
'confirm-restart-kernel':{
icon: 'fa-repeat',
help_index : 'hb',
help: 'restart the kernel (with dialog)',
cmd: i18n.msg._('confirm restart kernel'),
help: i18n.msg._('restart the kernel (with dialog)'),
handler : function (env) {
env.notebook.restart_kernel();
}
},
'restart-kernel-and-run-all-cells': {
help: 'restart the kernel, then re-run the whole notebook (no confirmation dialog)',
cmd: i18n.msg._('restart kernel and run all cells'),
help: i18n.msg._('restart the kernel, then re-run the whole notebook (no confirmation dialog)'),
handler: function (env) {
env.notebook.restart_run_all({confirm: false});
}
},
'confirm-restart-kernel-and-run-all-cells': {
help: 'restart the kernel, then re-run the whole notebook (with dialog)',
cmd: i18n.msg._('confirm restart kernel and run all cells'),
help: i18n.msg._('restart the kernel, then re-run the whole notebook (with dialog)'),
handler: function (env) {
env.notebook.restart_run_all();
}
},
'restart-kernel-and-clear-output': {
help: 'restart the kernel and clear all output (no confirmation dialog)',
cmd: i18n.msg._('restart kernel and clear output'),
help: i18n.msg._('restart the kernel and clear all output (no confirmation dialog)'),
handler: function (env) {
env.notebook.restart_clear_output({confirm: false});
}
},
'confirm-restart-kernel-and-clear-output': {
help: 'restart the kernel and clear all output (with dialog)',
cmd: i18n.msg._('confirm restart kernel and clear output'),
help: i18n.msg._('restart the kernel and clear all output (with dialog)'),
handler: function (env) {
env.notebook.restart_clear_output();
}
},
'interrupt-kernel':{
icon: 'fa-stop',
cmd: i18n.msg._('interrupt the kernel'),
help: i18n.msg._('interrupt the kernel'),
help_index : 'ha',
handler : function (env) {
env.notebook.kernel.interrupt();
}
},
'run-cell-and-select-next': {
cmd: i18n.msg._('run cell and select next'),
icon: 'fa-step-forward',
help : 'run cell, select below',
help: i18n.msg._('run cell, select below'),
help_index : 'ba',
handler : function (env) {
env.notebook.execute_cell_and_select_below();
}
},
'run-cell':{
help : 'run selected cells',
cmd: i18n.msg._('run selected cells'),
help : i18n.msg._('run selected cells'),
help_index : 'bb',
handler : function (env) {
env.notebook.execute_selected_cells();
}
},
'run-cell-and-insert-below':{
help : 'run cell, insert below',
cmd: i18n.msg._('run cell and insert below'),
help : i18n.msg._('run cell and insert below'),
help_index : 'bc',
handler : function (env) {
env.notebook.execute_cell_and_insert_below();
}
},
'run-all-cells': {
help: 'run all cells',
cmd: i18n.msg._('run all cells'),
help: i18n.msg._('run all cells'),
help_index: 'bd',
handler: function (env) {
env.notebook.execute_all_cells();
}
},
'run-all-cells-above':{
cmd: i18n.msg._('run all cells above'),
help: i18n.msg._('run all cells above'),
handler : function (env) {
env.notebook.execute_cells_above();
}
},
'run-all-cells-below':{
cmd: i18n.msg._('run all cells below'),
help: i18n.msg._('run all cells below'),
handler : function (env) {
env.notebook.execute_cells_below();
}
},
'enter-command-mode': {
help : 'command mode',
cmd: i18n.msg._('enter command mode'),
help : i18n.msg._('enter command mode'),
help_index : 'aa',
handler : function (env) {
env.notebook.command_mode();
}
},
'insert-image': {
help : 'insert image',
cmd: i18n.msg._('insert image'),
help : i18n.msg._('insert image'),
help_index : 'dz',
handler : function (env) {
env.notebook.insert_image();
}
},
'cut-cell-attachments': {
help : 'cut cell attachments',
cmd: i18n.msg._('cut cell attachments'),
help : i18n.msg._('cut cell attachments'),
help_index : 'dza',
handler: function (env) {
env.notebook.cut_cell_attachments();
}
},
'copy-cell-attachments': {
help : 'copy cell attachments',
cmd: i18n.msg._('copy cell attachments'),
help : i18n.msg._('copy cell attachments'),
help_index: 'dzb',
handler: function (env) {
env.notebook.copy_cell_attachments();
}
},
'paste-cell-attachments': {
help : 'paste cell attachments',
cmd: i18n.msg._('paste cell attachments'),
help : i18n.msg._('paste cell attachments'),
help_index: 'dzc',
handler: function (env) {
env.notebook.paste_cell_attachments();
}
},
'split-cell-at-cursor': {
help : 'split cell',
cmd: i18n.msg._('split cell at cursor'),
help : i18n.msg._('split cell at cursor'),
help_index : 'ea',
handler : function (env) {
env.notebook.split_cell();
}
},
'enter-edit-mode' : {
cmd: i18n.msg._('enter edit mode'),
help : i18n.msg._('enter edit mode'),
help_index : 'aa',
handler : function (env) {
env.notebook.edit_mode();
}
},
'select-previous-cell' : {
help: 'select cell above',
cmd: i18n.msg._('select previous cell'),
help: i18n.msg._('select cell above'),
help_index : 'da',
handler : function (env) {
var index = env.notebook.get_selected_index();
@ -233,7 +262,8 @@ define(function(require){
}
},
'select-next-cell' : {
help: 'select cell below',
cmd: i18n.msg._('select next cell'),
help: i18n.msg._('select cell below'),
help_index : 'db',
handler : function (env) {
var index = env.notebook.get_selected_index();
@ -244,7 +274,8 @@ define(function(require){
}
},
'extend-selection-above' : {
help: 'extend selected cells above',
cmd: i18n.msg._('extend selection above'),
help: i18n.msg._('extend selected cells above'),
help_index : 'dc',
handler : function (env) {
env.notebook.extend_selection_by(-1);
@ -255,7 +286,8 @@ define(function(require){
}
},
'extend-selection-below' : {
help: 'extend selected cells below',
cmd: i18n.msg._('extend selection below'),
help: i18n.msg._('extend selected cells below'),
help_index : 'dd',
handler : function (env) {
env.notebook.extend_selection_by(1);
@ -266,7 +298,8 @@ define(function(require){
}
},
'cut-cell' : {
help: 'cut selected cells',
cmd: i18n.msg._('cut selected cells'),
help: i18n.msg._('cut selected cells'),
icon: 'fa-cut',
help_index : 'ee',
handler : function (env) {
@ -276,7 +309,8 @@ define(function(require){
}
},
'copy-cell' : {
help: 'copy selected cells',
cmd: i18n.msg._('copy selected cells'),
help: i18n.msg._('copy selected cells'),
icon: 'fa-copy',
help_index : 'ef',
handler : function (env) {
@ -290,14 +324,16 @@ define(function(require){
}
},
'paste-cell-above' : {
help: 'paste cells above',
cmd: i18n.msg._('paste cells above'),
help: i18n.msg._('paste cells above'),
help_index : 'eg',
handler : function (env) {
env.notebook.paste_cell_above();
}
},
'paste-cell-below' : {
help: 'paste cells below',
cmd: i18n.msg._('paste cells below'),
help: i18n.msg._('paste cells below'),
icon: 'fa-paste',
help_index : 'eh',
handler : function (env) {
@ -305,7 +341,8 @@ define(function(require){
}
},
'insert-cell-above' : {
help: 'insert cell above',
cmd: i18n.msg._('insert cell above'),
help: i18n.msg._('insert cell above'),
help_index : 'ec',
handler : function (env) {
env.notebook.insert_cell_above();
@ -314,7 +351,8 @@ define(function(require){
}
},
'insert-cell-below' : {
help: 'insert cell below',
cmd: i18n.msg._('insert cell below'),
help: i18n.msg._('insert cell below'),
icon : 'fa-plus',
help_index : 'ed',
handler : function (env) {
@ -324,90 +362,103 @@ define(function(require){
}
},
'change-cell-to-code' : {
help : 'to code',
cmd: i18n.msg._('change cell to code'),
help : i18n.msg._('change cell to code'),
help_index : 'ca',
handler : function (env) {
env.notebook.cells_to_code();
}
},
'change-cell-to-markdown' : {
help : 'to markdown',
cmd: i18n.msg._('change cell to markdown'),
help : i18n.msg._('change cell to markdown'),
help_index : 'cb',
handler : function (env) {
env.notebook.cells_to_markdown();
}
},
'change-cell-to-raw' : {
help : 'to raw',
cmd: i18n.msg._('change cell to raw'),
help : i18n.msg._('change cell to raw'),
help_index : 'cc',
handler : function (env) {
env.notebook.cells_to_raw();
}
},
'change-cell-to-heading-1' : {
help : 'to heading 1',
cmd: i18n.msg._('change cell to heading 1'),
help : i18n.msg._('change cell to heading 1'),
help_index : 'cd',
handler : function (env) {
env.notebook.to_heading(undefined, 1);
}
},
'change-cell-to-heading-2' : {
help : 'to heading 2',
cmd: i18n.msg._('change cell to heading 2'),
help : i18n.msg._('change cell to heading 2'),
help_index : 'ce',
handler : function (env) {
env.notebook.to_heading(undefined, 2);
}
},
'change-cell-to-heading-3' : {
help : 'to heading 3',
cmd: i18n.msg._('change cell to heading 3'),
help : i18n.msg._('change cell to heading 3'),
help_index : 'cf',
handler : function (env) {
env.notebook.to_heading(undefined, 3);
}
},
'change-cell-to-heading-4' : {
help : 'to heading 4',
cmd: i18n.msg._('change cell to heading 4'),
help : i18n.msg._('change cell to heading 4'),
help_index : 'cg',
handler : function (env) {
env.notebook.to_heading(undefined, 4);
}
},
'change-cell-to-heading-5' : {
help : 'to heading 5',
cmd: i18n.msg._('change cell to heading 5'),
help : i18n.msg._('change cell to heading 5'),
help_index : 'ch',
handler : function (env) {
env.notebook.to_heading(undefined, 5);
}
},
'change-cell-to-heading-6' : {
help : 'to heading 6',
cmd: i18n.msg._('change cell to heading 6'),
help : i18n.msg._('change cell to heading 6'),
help_index : 'ci',
handler : function (env) {
env.notebook.to_heading(undefined, 6);
}
},
'toggle-cell-output-collapsed' : {
help : 'toggle output of selected cells',
cmd: i18n.msg._('toggle cell output'),
help : i18n.msg._('toggle output of selected cells'),
help_index : 'gb',
handler : function (env) {
env.notebook.toggle_cells_outputs();
}
},
'toggle-cell-output-scrolled' : {
help : 'toggle output scrolling of selected cells',
cmd: i18n.msg._('toggle cell scrolling'),
help : i18n.msg._('toggle output scrolling of selected cells'),
help_index : 'gc',
handler : function (env) {
env.notebook.toggle_cells_outputs_scroll();
}
},
'clear-cell-output' : {
help : 'clear output of selected cells',
cmd: i18n.msg._('clear cell output'),
help : i18n.msg._('clear output of selected cells'),
handler : function (env) {
env.notebook.clear_cells_outputs();
}
},
'move-cell-down' : {
help: 'move selected cells down',
cmd: i18n.msg._('move cells down'),
help: i18n.msg._('move selected cells down'),
icon: 'fa-arrow-down',
help_index : 'eb',
handler : function (env) {
@ -415,7 +466,8 @@ define(function(require){
}
},
'move-cell-up' : {
help: 'move selected cells up',
cmd: i18n.msg._('move cells up'),
help: i18n.msg._('move selected cells up'),
icon: 'fa-arrow-up',
help_index : 'ea',
handler : function (env) {
@ -423,26 +475,32 @@ define(function(require){
}
},
'toggle-cell-line-numbers' : {
help : 'toggle line numbers',
cmd: i18n.msg._('toggle line numbers'),
help : i18n.msg._('toggle line numbers'),
help_index : 'ga',
handler : function (env) {
env.notebook.cell_toggle_line_numbers();
}
},
'show-keyboard-shortcuts' : {
cmd: i18n.msg._('show keyboard shortcuts'),
help : i18n.msg._('show keyboard shortcuts'),
help_index : 'ge',
handler : function (env) {
env.quick_help.show_keyboard_shortcuts();
}
},
'delete-cell': {
help: 'delete selected cells',
cmd: i18n.msg._('delete cells'),
help: i18n.msg._('delete selected cells'),
help_index : 'ej',
handler : function (env) {
env.notebook.delete_cell();
}
},
'undo-cell-deletion' : {
cmd: i18n.msg._('undo cell deletion'),
help: i18n.msg._('undo cell deletion'),
help_index : 'ei',
handler : function (env) {
env.notebook.undelete_cell();
@ -451,26 +509,31 @@ define(function(require){
// TODO reminder
// open an issue, merge with above merge with last cell of notebook if at top.
'merge-cell-with-previous-cell' : {
cmd: i18n.msg._('merge cell with previous cell'),
help : i18n.msg._('merge cell above'),
handler : function (env) {
env.notebook.merge_cell_above();
}
},
'merge-cell-with-next-cell' : {
help : 'merge cell below',
cmd: i18n.msg._('merge cell with next cell'),
help : i18n.msg._('merge cell below'),
help_index : 'ek',
handler : function (env) {
env.notebook.merge_cell_below();
}
},
'merge-selected-cells' : {
help : 'merge selected cells',
cmd: i18n.msg._('merge selected cells'),
help : i18n.msg._('merge selected cells'),
help_index: 'el',
handler: function(env) {
env.notebook.merge_selected_cells();
}
},
'merge-cells' : {
help : 'merge selected cells, or current cell with cell below if only one cell selected',
cmd: i18n.msg._('merge cells'),
help : i18n.msg._('merge selected cells, or current cell with cell below if only one cell is selected'),
help_index: 'el',
handler: function(env) {
var l = env.notebook.get_selected_cells_indices().length;
@ -483,14 +546,16 @@ define(function(require){
},
'show-command-palette': {
help_index : 'aa',
help: 'open the command palette',
cmd: i18n.msg._('show command pallette'),
help: i18n.msg._('open the command palette'),
icon: 'fa-keyboard-o',
handler : function(env){
env.notebook.show_command_palette();
}
},
'toggle-all-line-numbers': {
help : 'toggles line numbers in all cells, and persist the setting',
cmd: i18n.msg._('toggle all line numbers'),
help : i18n.msg._('toggles line numbers in all cells, and persist the setting'),
icon: 'fa-list-ol',
handler: function(env) {
var value = !env.notebook.line_numbers;
@ -501,7 +566,8 @@ define(function(require){
}
},
'show-all-line-numbers': {
help : 'show line numbers in all cells, and persist the setting',
cmd: i18n.msg._('show all line numbers'),
help : i18n.msg._('show line numbers in all cells, and persist the setting'),
handler: function(env) {
env.notebook.get_cells().map(function(c) {
c.code_mirror.setOption('lineNumbers', true);
@ -510,7 +576,8 @@ define(function(require){
}
},
'hide-all-line-numbers': {
help : 'hide line numbers in all cells, and persist the setting',
cmd: i18n.msg._('hide all line numbers'),
help : i18n.msg._('hide line numbers in all cells, and persist the setting'),
handler: function(env) {
env.notebook.get_cells().map(function(c) {
c.code_mirror.setOption('lineNumbers', false);
@ -519,7 +586,8 @@ define(function(require){
}
},
'toggle-header':{
help: 'hide/show the header',
cmd: i18n.msg._('toggle header'),
help: i18n.msg._('switch between showing and hiding the header'),
handler : function(env) {
var value = !env.notebook.header;
if (value === true) {
@ -534,7 +602,8 @@ define(function(require){
}
},
'show-header':{
help: 'show the header',
cmd: i18n.msg._('show the header'),
help: i18n.msg._('show the header'),
handler : function(env) {
$('#header-container').show();
$('.header-bar').show();
@ -543,7 +612,8 @@ define(function(require){
}
},
'hide-header':{
help: 'hide the header',
cmd: i18n.msg._('hide the header'),
help: i18n.msg._('hide the header'),
handler : function(env) {
$('#header-container').hide();
$('.header-bar').hide();
@ -573,7 +643,8 @@ define(function(require){
}
},
'toggle-toolbar':{
help: 'hide/show the toolbar',
cmd: i18n.msg._('toggle toolbar'),
help: i18n.msg._('switch between showing and hiding the toolbar'),
handler : function(env) {
var value = !env.notebook.toolbar;
if (value === true) {
@ -586,7 +657,8 @@ define(function(require){
}
},
'show-toolbar':{
help: 'show the toolbar',
cmd: i18n.msg._('show the toolbar'),
help: i18n.msg._('show the toolbar'),
handler : function(env) {
$('div#maintoolbar').show();
events.trigger('resize-header.Page');
@ -594,7 +666,8 @@ define(function(require){
}
},
'hide-toolbar':{
help: 'hide the toolbar',
cmd: i18n.msg._('hide the toolbar'),
help: i18n.msg._('hide the toolbar'),
handler : function(env) {
$('div#maintoolbar').hide();
events.trigger('resize-header.Page');
@ -602,7 +675,8 @@ define(function(require){
}
},
'close-pager': {
help : 'close the pager',
cmd: i18n.msg._('close the pager'),
help : i18n.msg._('close the pager'),
handler : function(env) {
// Collapse the page if it is open
if (env.pager && env.pager.expanded) {
@ -627,11 +701,14 @@ define(function(require){
**/
var custom_ignore = {
'ignore':{
cmd: i18n.msg._('ignore'),
handler : function () {
return true;
}
},
'move-cursor-up':{
cmd: i18n.msg._('move cursor up'),
help: i18n.msg._("move cursor up"),
handler : function (env, event) {
var index = env.notebook.get_selected_index();
var cell = env.notebook.get_cell(index);
@ -651,6 +728,8 @@ define(function(require){
}
},
'move-cursor-down':{
cmd: i18n.msg._('move cursor down'),
help: i18n.msg._("move cursor down"),
handler : function (env, event) {
var index = env.notebook.get_selected_index();
var cell = env.notebook.get_cell(index);
@ -668,6 +747,8 @@ define(function(require){
}
},
'scroll-notebook-down': {
cmd: i18n.msg._('scroll notebook down'),
help: i18n.msg._("scroll notebook down"),
handler: function(env, event) {
if(event){
event.preventDefault();
@ -676,6 +757,8 @@ define(function(require){
},
},
'scroll-notebook-up': {
cmd: i18n.msg._('scroll notebook up'),
help: i18n.msg._("scroll notebook up"),
handler: function(env, event) {
if(event){
event.preventDefault();
@ -684,7 +767,8 @@ define(function(require){
},
},
'scroll-cell-center': {
help: "Scroll the current cell to the center",
cmd: i18n.msg._('scroll cell center'),
help: i18n.msg._("Scroll the current cell to the center"),
handler: function (env, event) {
if(event){
event.preventDefault();
@ -694,7 +778,8 @@ define(function(require){
}
},
'scroll-cell-top': {
help: "Scroll the current cell to the top",
cmd: i18n.msg._('scroll cell top'),
help: i18n.msg._("Scroll the current cell to the top"),
handler: function (env, event) {
if(event){
event.preventDefault();
@ -704,44 +789,51 @@ define(function(require){
}
},
'duplicate-notebook':{
help: "Create an open a copy of current notebook",
cmd: i18n.msg._('duplicate notebook'),
help: i18n.msg._("Create and open a copy of the current notebook"),
handler : function (env, event) {
env.notebook.copy_notebook();
}
},
'trust-notebook':{
help: "Trust the current notebook",
cmd: i18n.msg._('trust notebook'),
help: i18n.msg._("Trust the current notebook"),
handler : function (env, event) {
env.notebook.trust_notebook();
}
},
'rename-notebook':{
help: "Rename current notebook",
cmd: i18n.msg._('rename notebook'),
help: i18n.msg._("Rename the current notebook"),
handler : function (env, event) {
env.notebook.save_widget.rename_notebook({notebook: env.notebook});
}
},
'toggle-all-cells-output-collapsed':{
help: "Toggle the hiddens state of all output areas",
cmd: i18n.msg._('toggle all cells output collapsed'),
help: i18n.msg._("Toggle the hidden state of all output areas"),
handler : function (env, event) {
env.notebook.toggle_all_output();
}
},
'toggle-all-cells-output-scrolled':{
help: "Toggle the scrolling state of all output areas",
cmd: i18n.msg._('toggle all cells output scrolled'),
help: i18n.msg._("Toggle the scrolling state of all output areas"),
handler : function (env, event) {
env.notebook.toggle_all_output_scroll();
}
},
'clear-all-cells-output':{
help: "Clear the content of all the outputs",
cmd: i18n.msg._('clear all cells output'),
help: i18n.msg._("Clear the content of all the outputs"),
handler : function (env, event) {
env.notebook.clear_all_output();
}
},
'save-notebook':{
help: "Save and Checkpoint",
cmd: i18n.msg._('save notebook'),
help: i18n.msg._("Save and Checkpoint"),
help_index : 'fb',
icon: 'fa-save',
handler : function (env, event) {
@ -758,6 +850,7 @@ define(function(require){
// and uniformize/fill in missing pieces in of an action.
var _prepare_handler = function(registry, subkey, source){
registry['jupyter-notebook:'+subkey] = {};
registry['jupyter-notebook:'+subkey].cmd = source[subkey].cmd;
registry['jupyter-notebook:'+subkey].help = source[subkey].help||subkey.replace(/-/g,' ');
registry['jupyter-notebook:'+subkey].help_index = source[subkey].help_index;
registry['jupyter-notebook:'+subkey].icon = source[subkey].icon;

@ -12,12 +12,13 @@
define([
'jquery',
'base/js/utils',
'base/js/i18n',
'codemirror/lib/codemirror',
'codemirror/addon/edit/matchbrackets',
'codemirror/addon/edit/closebrackets',
'codemirror/addon/comment/comment',
'services/config',
], function($, utils, CodeMirror, cm_match, cm_closeb, cm_comment, configmod) {
], function($, utils, i18n, CodeMirror, cm_match, cm_closeb, cm_comment, configmod) {
"use strict";
var overlayHack = CodeMirror.scrollbarModel.native.prototype.overlayHack;
@ -75,7 +76,7 @@ define([
// backward compat.
Object.defineProperty(this, 'cm_config', {
get: function() {
console.warn("Warning: accessing Cell.cm_config directly is deprecated.");
console.warn(i18n.msg._("Warning: accessing Cell.cm_config directly is deprecated."));
return that._options.cm_config;
},
});
@ -759,7 +760,7 @@ define([
} else {
data.metadata = this.metadata;
}
this.element.find('.inner_cell').find("a").text("Unrecognized cell type: " + data.cell_type);
this.element.find('.inner_cell').find("a").text(i18n.msg.sprintf(i18n.msg._("Unrecognized cell type: %s"), data.cell_type));
};
UnrecognizedCell.prototype.create_element = function () {
@ -773,7 +774,7 @@ define([
inner_cell.append(
$("<a>")
.attr("href", "#")
.text("Unrecognized cell type")
.text(i18n.msg._("Unrecognized cell type"))
);
cell.append(inner_cell);
this.element = cell;

@ -4,8 +4,9 @@
define([
'jquery',
'base/js/namespace',
'base/js/events'
], function($, IPython, events) {
'base/js/events',
'base/js/i18n'
], function($, IPython, events, i18n) {
"use strict";
var CellToolbar = function (options) {
@ -292,7 +293,7 @@ define([
callback(local_div, this.cell, this);
this.ui_controls_list.push(key);
} catch (e) {
console.log("Error in cell toolbar callback " + key, e);
console.log(i18n.msg.sprintf(i18n.msg._("Error in cell toolbar callback %s"), key), e);
continue;
}
// only append if callback succeeded.

@ -4,7 +4,8 @@
define([
'notebook/js/celltoolbar',
'base/js/dialog',
], function(celltoolbar, dialog) {
'base/js/i18n'
], function(celltoolbar, dialog, i18n) {
"use strict";
var CellToolbar = celltoolbar.CellToolbar;
@ -28,7 +29,7 @@ define([
var button_container = $(div);
var button = $('<button />')
.addClass('btn btn-default btn-xs')
.text('Edit Attachments')
.text(i18n.msg._('Edit Attachments'))
.click( function() {
edit_attachments_dialog(cell);
return false;
@ -42,7 +43,7 @@ define([
var attachments_preset = [];
attachments_preset.push('attachments.edit');
CellToolbar.register_preset('Attachments', attachments_preset, notebook);
CellToolbar.register_preset(i18n.msg._('Attachments'), attachments_preset, notebook);
};
return {'register' : register};

@ -4,7 +4,8 @@
define([
'notebook/js/celltoolbar',
'base/js/dialog',
], function(celltoolbar, dialog) {
'base/js/i18n'
], function(celltoolbar, dialog, i18n) {
"use strict";
var CellToolbar = celltoolbar.CellToolbar;
@ -15,7 +16,7 @@ define([
callback: function (md) {
cell.metadata = md;
},
name: 'Cell',
name: i18n.msg._('Cell'),
notebook: this.notebook,
keyboard_manager: this.keyboard_manager
});
@ -25,7 +26,7 @@ define([
var button_container = $(div);
var button = $('<button/>')
.addClass("btn btn-default btn-xs")
.text("Edit Metadata")
.text(i18n.msg._("Edit Metadata"))
.click( function () {
raw_edit(cell);
return false;
@ -43,7 +44,7 @@ define([
var example_preset = [];
example_preset.push('default.rawedit');
CellToolbar.register_preset('Edit Metadata', example_preset, notebook);
CellToolbar.register_preset(i18n.msg._('Edit Metadata'), example_preset, notebook);
};
return {'register': register};
});

@ -5,20 +5,21 @@ define([
'notebook/js/celltoolbar',
'base/js/dialog',
'base/js/keyboard',
], function(celltoolbar, dialog, keyboard) {
'base/js/i18n'
], function(celltoolbar, dialog, keyboard, i18n) {
"use strict";
var CellToolbar = celltoolbar.CellToolbar;
var raw_cell_preset = [];
var select_type = CellToolbar.utils.select_ui_generator([
["None", "-"],
[i18n.msg._("None"), "-"],
["LaTeX", "text/latex"],
["reST", "text/restructuredtext"],
["HTML", "text/html"],
["Markdown", "text/markdown"],
["Python", "text/x-python"],
["Custom", "dialog"],
[i18n.msg._("Custom"), "dialog"],
],
// setter
@ -28,7 +29,7 @@ define([
} else if (value === 'dialog'){
var dialog = $('<div/>').append(
$("<p/>")
.text("Set the MIME type of the raw cell:")
.text(i18n.msg._("Set the MIME type of the raw cell:"))
).append(
$("<br/>")
).append(
@ -36,7 +37,7 @@ define([
.val(cell.metadata.raw_mimetype || "-")
);
dialog.modal({
title: "Raw Cell MIME Type",
title: i18n.msg._("Raw Cell MIME Type"),
body: dialog,
buttons : {
"Cancel": {},
@ -70,14 +71,14 @@ define([
return cell.metadata.raw_mimetype || "";
},
// name
"Raw NBConvert Format"
i18n.msg._("Raw NBConvert Format")
);
var register = function (notebook) {
CellToolbar.register_callback('raw_cell.select', select_type, ['raw']);
raw_cell_preset.push('raw_cell.select');
CellToolbar.register_preset('Raw Cell Format', raw_cell_preset, notebook);
CellToolbar.register_preset(i18n.msg._('Raw Cell Format'), raw_cell_preset, notebook);
};
return {'register': register};

@ -3,20 +3,20 @@
define([
'notebook/js/celltoolbar',
], function(celltoolbar) {
'base/js/i18n'
], function(celltoolbar, i18n) {
"use strict";
var CellToolbar = celltoolbar.CellToolbar;
var slideshow_preset = [];
var select_type = CellToolbar.utils.select_ui_generator([
["-" ,"-" ],
["Slide" ,"slide" ],
["Sub-Slide" ,"subslide" ],
["Fragment" ,"fragment" ],
["Skip" ,"skip" ],
["Notes" ,"notes" ],
[i18n.msg._("Slide") ,"slide" ],
[i18n.msg._("Sub-Slide") ,"subslide" ],
[i18n.msg._("Fragment") ,"fragment" ],
[i18n.msg._("Skip") ,"skip" ],
[i18n.msg._("Notes") ,"notes" ],
],
// setter
function(cell, value){
@ -32,13 +32,13 @@ define([
// return the value
return (ns === undefined)? undefined: ns.slide_type;
},
"Slide Type");
i18n.msg._("Slide Type"));
var register = function (notebook) {
CellToolbar.register_callback('slideshow.select',select_type);
slideshow_preset.push('slideshow.select');
CellToolbar.register_preset('Slideshow',slideshow_preset, notebook);
CellToolbar.register_preset(i18n.msg._('Slideshow'),slideshow_preset, notebook);
};
return {'register': register};
});

@ -4,7 +4,8 @@
define([
'notebook/js/celltoolbar',
'base/js/dialog',
], function(celltoolbar, dialog) {
'base/js/i18n'
], function(celltoolbar, dialog, i18n) {
"use strict";
var CellToolbar = celltoolbar.CellToolbar;
@ -129,7 +130,7 @@ define([
var text = $('<input/>').attr('type', 'text');
var button = $('<button />')
.addClass('btn btn-default btn-xs')
.text('Add tag')
.text(i18n.msg._('Add tag'))
.click(function() {
var tags = preprocess_input(text[0].value);
for (var i=0; i < tags.length; ++i) {
@ -159,8 +160,8 @@ define([
var tag_list = cell.metadata.tags || [];
var message =
"Edit the list of tags below. All whitespace " +
"is treated as tag separators.";
i18n.msg._("Edit the list of tags below. All whitespace " +
"is treated as tag separators.");
var textarea = $('<textarea/>')
.attr('rows', '13')
@ -168,7 +169,7 @@ define([
.attr('name', 'tags')
.text(tag_list.join('\n'));
var dialogform = $('<div/>').attr('title', 'Edit the tags')
var dialogform = $('<div/>').attr('title', i18n.msg._('Edit the tags'))
.append(
$('<form/>').append(
$('<fieldset/>').append(
@ -182,7 +183,7 @@ define([
);
var modal_obj = dialog.modal({
title: "Edit Tags",
title: i18n.msg._("Edit Tags"),
body: dialogform,
default_button: "Cancel",
buttons: {

@ -5,8 +5,9 @@ define([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/i18n',
'base/js/dialog'
], function($, Jupyter, utils, dialog) {
], function($, Jupyter, utils, i18n, dialog) {
var jcbprefix = '<pre class="jupyter-nb-cells-json">';
var jcbsuffix = '</pre>';
@ -49,7 +50,7 @@ function paste(event) {
if (Jupyter.notebook.mode !== 'command') {
return;
}
console.log('Clipboard types: ' + event.clipboardData.types);
console.log(i18n.msg.sprintf(i18n.msg._('Clipboard types: %s'),event.clipboardData.types));
cells = load_json(event.clipboardData);
// console.log(cells);
// Does this JSON look like cells?
@ -92,7 +93,7 @@ function setup_paste_dialog() {
// second Ctrl-V
var action = {
icon: 'fa-clipboard', // a font-awesome class used on buttons, etc
help : 'Dialog for paste from system clipboard',
help : i18n.msg._('Dialog for paste from system clipboard'),
help_index : 'zz',
handler : function () {
var entry_box = $('<input type="text"/>');
@ -105,20 +106,23 @@ function setup_paste_dialog() {
document.removeEventListener('paste', paste_close_dlg);
}
document.addEventListener('paste', paste_close_dlg);
var cmdtrl = 'Ctrl';
var cmdtrl = i18n.msg._('Ctrl-V');
if (utils.platform === 'MacOS') {
cmdtrl = 'Cmd';
cmdtrl = i18n.msg._('Cmd-V');
}
var dialog_body = $("<div/>").append("<p>Press "+cmdtrl+"-V again to paste")
var dialog_body = $("<div/>").append("<p>").append(i18n.msg.sprintf(i18n.msg._("Press %s again to paste"),cmdtrl))
.append("<br/>")
.append("<p><b>Why is this needed?</b> We can't get paste events in this browser without a text box. "+
"There's an invisible text box focused in this dialog.")
.append("<p><b>")
.append(i18n.msg._("Why is this needed? "))
.append("</b>")
.append(i18n.msg._("We can't get paste events in this browser without a text box. "))
.append(i18n.msg._("There's an invisible text box focused in this dialog."))
.append($("<form/>").append(entry_box));
var paste_dlg = dialog.modal({
notebook: Jupyter.notebook,
keyboard_manager: Jupyter.keyboard_manager,
title : cmdtrl+"-V to paste",
title : i18n.msg.sprintf(i18n.msg._("%s to paste"),cmdtrl),
body : dialog_body,
open: function() {
entry_box.focus();

@ -13,6 +13,7 @@ define([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/i18n',
'base/js/keyboard',
'services/config',
'notebook/js/cell',
@ -26,6 +27,7 @@ define([
$,
IPython,
utils,
i18n,
keyboard,
configmod,
cell,
@ -305,7 +307,7 @@ define([
*/
CodeCell.prototype.execute = function (stop_on_error) {
if (!this.kernel) {
console.log("Can't execute cell since kernel is not set.");
console.log(i18n.msg._("Can't execute cell since kernel is not set."));
return;
}
@ -346,9 +348,9 @@ define([
var that = this;
function handleFinished(evt, data) {
if (that.kernel.id === data.kernel.id && that.last_msg_id === data.msg_id) {
that.events.trigger('finished_execute.CodeCell', {cell: that});
that.events.trigger('finished_execute.CodeCell', {cell: that});
that.events.off('finished_iopub.Kernel', handleFinished);
}
}
}
this.events.on('finished_iopub.Kernel', handleFinished);
};
@ -476,7 +478,7 @@ define([
} else {
ns = encodeURIComponent(prompt_value);
}
return '<bdi>In</bdi>&nbsp;[' + ns + ']:';
return '<bdi>'+i18n.msg._('In')+'</bdi>&nbsp;[' + ns + ']:';
};
CodeCell.input_prompt_continuation = function (prompt_value, lines_number) {

@ -1,13 +1,14 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(function(require){
define([
'jquery',
'typeahead',
'base/js/i18n',
'notebook/js/quickhelp'
],function($, typeahead, i18n, QH){
"use strict";
var $ = require('jquery');
require('typeahead');
var QH = require("notebook/js/quickhelp");
/**
* Humanize the action name to be consumed by user.
* internaly the actions anem are of the form
@ -150,13 +151,20 @@ define(function(require){
short = QH.humanize_sequence(short);
}
var display_text;
if (action.cmd) {
display_text = i18n.msg._(action.cmd);
} else {
display_text = humanize_action_id(action_id);
}
src[group].data.push({
display: humanize_action_id(action_id),
display: display_text,
shortcut: short,
mode_shortcut: get_mode_for_action_id(action_id, notebook),
group: group,
icon: action.icon,
help: action.help,
help: i18n.msg._(action.help),
key: action_id,
});
}

@ -5,8 +5,9 @@ define([
'jquery',
'base/js/namespace',
'base/js/dialog',
'base/js/utils'
], function($, IPython, dialog, utils) {
'base/js/utils',
'base/js/i18n'
], function($, IPython, dialog, utils, i18n) {
"use strict";
var KernelSelector = function(selector, notebook) {
@ -265,15 +266,19 @@ define([
);
});
var no_kernel_msg = i18n.msg.sprintf(i18n.msg._("Could not find a kernel matching %s. Please select a kernel:"),
(data.selected.display_name || data.selected.name))
var body = $("<form>").addClass("form-inline").append(
$("<span>").text(
"I couldn't find a kernel matching " + (data.selected.display_name || data.selected.name) + "." +
" Please select a kernel:"
)
$("<span>").text(no_kernel_msg)
).append(select);
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [ i18n.msg._("Continue Without Kernel"), i18n.msg._("Set Kernel"), i18n.msg._("OK") ];
dialog.modal({
title : 'Kernel not found',
title : i18n.msg._('Kernel not found'),
body : body,
buttons : {
'Continue Without Kernel' : {
@ -311,8 +316,8 @@ define([
function(error) {
w.close();
dialog.modal({
title : 'Creating Notebook Failed',
body : "The error was: " + error.message,
title : i18n.msg._('Creating Notebook Failed'),
body : i18n.msg.sprintf(i18n.msg._("The error was: %s"), error.message),
buttons : {'OK' : {'class' : 'btn-primary'}}
});
}

@ -5,8 +5,9 @@ define([
'jquery',
'require',
'./toolbar',
'./celltoolbar'
], function($, require, toolbar, celltoolbar) {
'./celltoolbar',
'base/js/i18n'
], function($, require, toolbar, celltoolbar, i18n) {
"use strict";
var MainToolBar = function (selector, options) {
@ -50,7 +51,7 @@ define([
],
'move_up_down'],
[ [new toolbar.Button('jupyter-notebook:run-cell-and-select-next',
{label: 'Run'}),
{label: i18n.msg._('Run')}),
'jupyter-notebook:interrupt-kernel',
'jupyter-notebook:confirm-restart-kernel'
],
@ -72,10 +73,10 @@ define([
var sel = $('<select/>')
.attr('id','cell_type')
.addClass('form-control select-xs')
.append($('<option/>').attr('value','code').text('Code'))
.append($('<option/>').attr('value','markdown').text('Markdown'))
.append($('<option/>').attr('value','raw').text('Raw NBConvert'))
.append($('<option/>').attr('value','heading').text('Heading'))
.append($('<option/>').attr('value','code').text(i18n.msg._('Code')))
.append($('<option/>').attr('value','markdown').text(i18n.msg._('Markdown')))
.append($('<option/>').attr('value','raw').text(i18n.msg._('Raw NBConvert')))
.append($('<option/>').attr('value','heading').text(i18n.msg._('Heading')))
.append(multiselect);
this.notebook.keyboard_manager.register_events(sel);
this.events.on('selected_cell_type_changed.Notebook', function (event, data) {
@ -111,7 +112,7 @@ define([
case 'multiselect':
break;
default:
console.log("unrecognized cell type:", cell_type);
console.log(i18n.msg._("unrecognized cell type:"), cell_type);
}
that.notebook.focus_cell();
});

@ -4,6 +4,7 @@
define([
'jquery',
'base/js/utils',
'base/js/i18n',
'base/js/dialog',
], function($, utils, dialog) {
"use strict";
@ -35,11 +36,15 @@ define([
});
MathJax.Hub.Configured();
} else if (window.mathjax_url !== "") {
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [ i18n.msg._("OK") ];
// Don't have MathJax, but should. Show dialog.
dialog.modal({
title : "Failed to retrieve MathJax from '" + window.mathjax_url + "'",
title : i18n.msg.sprintf(i18n.msg._("Failed to retrieve MathJax from '%s'",window.mathjax_url)),
body : $("<p/>").addClass('dialog').text(
"Math/LaTeX rendering will be disabled."
i18n.msg._("Math/LaTeX rendering will be disabled.")
),
buttons : {
OK : {class: "btn-danger"}
@ -202,11 +207,11 @@ define([
// and clear the math array (no need to keep it around).
//
var replace_math = function (text, math) {
//
// Replaces a math placeholder with its corresponding group.
// The math delimiters "\\(", "\\[", "\\)" and "\\]" are replaced
// removing one backslash in order to be interpreted correctly by MathJax.
//
//
// Replaces a math placeholder with its corresponding group.
// The math delimiters "\\(", "\\[", "\\)" and "\\]" are replaced
// removing one backslash in order to be interpreted correctly by MathJax.
//
var math_group_process = function (match, n) {
var math_group = math[n];

@ -6,12 +6,13 @@ define([
'base/js/namespace',
'base/js/dialog',
'base/js/utils',
'base/js/i18n',
'./celltoolbar',
'./tour',
'moment',
], function($, IPython, dialog, utils, celltoolbar, tour, moment) {
], function($, IPython, dialog, utils, i18n, celltoolbar, tour, moment) {
"use strict";
var MenuBar = function (selector, options) {
/**
* Constructor
@ -216,13 +217,13 @@ define([
if (trusted) {
that.element.find('#trust_notebook')
.addClass("disabled").off('click')
.find("a").text("Trusted Notebook");
.find("a").text(i18n.msg._("Trusted Notebook"));
} else {
that.element.find('#trust_notebook')
.removeClass("disabled").on('click', function () {
that.notebook.trust_notebook();
})
.find("a").text("Trust Notebook");
.find("a").text(i18n.msg._("Trust Notebook"));
}
});
@ -379,7 +380,7 @@ define([
// Setup the existing presets
var presets = celltoolbar.CellToolbar.list_presets();
preset_added(null, {name: "None"});
preset_added(null, {name: i18n.msg._("None")});
presets.map(function (name) {
preset_added(null, {name: name});
});
@ -402,7 +403,7 @@ define([
.addClass("disabled")
.append(
$("<a/>")
.text("No checkpoints")
.text(i18n.msg._("No checkpoints"))
)
);
return;
@ -461,7 +462,7 @@ define([
cursor.after($("<li>")
.append($("<a>")
.attr('target', '_blank')
.attr('title', 'Opens in a new window')
.attr('title', i18n.msg._('Opens in a new window'))
.attr('href', requirejs.toUrl(link.url))
.append($("<i>")
.addClass("fa fa-external-link menu-icon pull-right")

@ -10,6 +10,7 @@ define([
'base/js/namespace',
'underscore',
'base/js/utils',
'base/js/i18n',
'base/js/dialog',
'./cell',
'./textcell',
@ -37,6 +38,7 @@ define([
IPython,
_,
utils,
i18n,
dialog,
cellmod,
textcell,
@ -62,6 +64,7 @@ define([
) {
var ShortcutEditor = shortcuteditor.ShortcutEditor;
var _SOFT_SELECTION_CLASS = 'jupyter-soft-selected';
function soft_selected(cell){
@ -425,14 +428,14 @@ define([
that.save_notebook();
}
}, 1000);
return "Autosave in progress, latest changes may be lost.";
return i18n.msg._("Autosave in progress, latest changes may be lost.");
} else {
return "Unsaved changes will be lost.";
return i18n.msg._("Unsaved changes will be lost.");
}
}
// if the kernel is busy, prompt the user if hes sure
if (that.kernel_busy) {
return "The Kernel is busy, outputs may be lost.";
return i18n.msg._("The Kernel is busy, outputs may be lost.");
}
// IE treats null as a string. Instead just return which will avoid the dialog.
return;
@ -455,14 +458,29 @@ define([
var v = 'v' + this.nbformat + '.';
var orig_vs = v + this.nbformat_minor;
var this_vs = v + this.current_nbformat_minor;
var msg = "This notebook is version " + orig_vs + ", but we only fully support up to " +
this_vs + ". You can still work with this notebook, but cell and output types " +
"introduced in later notebook versions will not be available.";
var msg = i18n.msg.sprintf(i18n.msg._("This notebook is version %1$s, but we only fully support up to %2$s."),
orig_vs,this_vs) + " " +
i18n.msg._("You can still work with this notebook, but cell and output types introduced in later notebook versions will not be available.");
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [
i18n.msg._("OK"),
i18n.msg._("Restart and Run All Cells"),
i18n.msg._("Restart and Clear All Outputs"),
i18n.msg._("Restart"),
i18n.msg._("Continue Running"),
i18n.msg._("Reload"),
i18n.msg._("Cancel"),
i18n.msg._("Overwrite"),
i18n.msg._("Trust"),
i18n.msg._("Revert")];
dialog.modal({
notebook: this,
keyboard_manager: this.keyboard_manager,
title : "Newer Notebook",
title : i18n.msg._("Newer Notebook"),
body : msg,
buttons : {
OK : {
@ -1527,12 +1545,12 @@ define([
dialog.modal({
notebook: this,
keyboard_manager: this.keyboard_manager,
title : "Use markdown headings",
title : i18n.msg._("Use markdown headings"),
body : $("<p/>").text(
'Jupyter no longer uses special heading cells. ' +
'Instead, write your headings in Markdown cells using # characters:'
i18n.msg._('Jupyter no longer uses special heading cells. ' +
'Instead, write your headings in Markdown cells using # characters:')
).append($('<pre/>').text(
'## This is a level 2 heading'
i18n.msg._('## This is a level 2 heading')
)),
buttons : {
"OK" : {}
@ -2227,9 +2245,9 @@ define([
restart_options.dialog = {
notebook: that,
keyboard_manager: that.keyboard_manager,
title : "Restart kernel and re-run the whole notebook?",
title : i18n.msg._("Restart kernel and re-run the whole notebook?"),
body : $("<p/>").text(
'Are you sure you want to restart the current kernel and re-execute the whole notebook? All variables and outputs will be lost.'
i18n.msg._('Are you sure you want to restart the current kernel and re-execute the whole notebook? All variables and outputs will be lost.')
),
buttons : {
"Restart and Run All Cells" : {
@ -2254,9 +2272,9 @@ define([
restart_options.dialog = {
notebook: that,
keyboard_manager: that.keyboard_manager,
title : "Restart kernel and clear all output?",
title : i18n.msg._("Restart kernel and clear all output?"),
body : $("<p/>").text(
'Do you want to restart the current kernel and clear all output? All variables and outputs will be lost.'
i18n.msg._('Do you want to restart the current kernel and clear all output? All variables and outputs will be lost.')
),
buttons : {
"Restart and Clear All Outputs" : {
@ -2301,9 +2319,9 @@ define([
var restart_options = {};
restart_options.confirm = (options || {}).confirm;
restart_options.dialog = {
title : "Restart kernel?",
title : i18n.msg._("Restart kernel?"),
body : $("<p/>").text(
'Do you want to restart the current kernel? All variables will be lost.'
i18n.msg._('Do you want to restart the current kernel? All variables will be lost.')
),
buttons : {
"Restart" : {
@ -2713,10 +2731,10 @@ define([
that._changed_on_disk_dialog = dialog.modal({
notebook: that,
keyboard_manager: that.keyboard_manager,
title: "Notebook changed",
body: "The notebook file has changed on disk since the last time we opened or saved it. "+
"Do you want to overwrite the file on disk with the version open here, or load "+
"the version on disk (reload the page) ?",
title: i18n.msg._("Notebook changed"),
body: i18n.msg._("The notebook file has changed on disk since the last time we opened or saved it. "
+ "Do you want to overwrite the file on disk with the version open here, or load "
+ "the version on disk (reload the page) ?"),
buttons: {
Reload: {
class: 'btn-warning',
@ -2761,12 +2779,12 @@ define([
if (data.message) {
// save succeeded, but validation failed.
var body = $("<div>");
var title = "Notebook validation failed";
var title = i18n.msg._("Notebook validation failed");
body.append($("<p>").text(
"The save operation succeeded," +
i18n.msg._("The save operation succeeded," +
" but the notebook does not appear to be valid." +
" The validation error was:"
" The validation error was:")
)).append($("<div>").addClass("validation-error").append(
$("<pre>").text(data.message)
));
@ -2815,25 +2833,19 @@ define([
*/
Notebook.prototype.trust_notebook = function () {
var body = $("<div>").append($("<p>")
.text("A trusted Jupyter notebook may execute hidden malicious code ")
.append($("<strong>")
.append(
$("<em>").text("when you open it")
)
).append(".").append(
" Selecting trust will immediately reload this notebook in a trusted state."
).append(
" For more information, see the "
).append($("<a>").attr("href", "https://jupyter-notebook.readthedocs.io/en/latest/security.html")
.text("Jupyter security documentation")
).append(".")
.text(i18n.msg._("A trusted Jupyter notebook may execute hidden malicious code when you open it. " +
"Selecting trust will immediately reload this notebook in a trusted state. " +
"For more information, see the Jupyter security documentation: "))
.append($("<a>").attr("href", "https://jupyter-notebook.readthedocs.io/en/latest/security.html")
.text(i18n.msg._("here"))
)
);
var nb = this;
dialog.modal({
notebook: this,
keyboard_manager: this.keyboard_manager,
title: "Trust this notebook?",
title: i18n.msg._("Trust this notebook?"),
body: body,
buttons: {
@ -2966,24 +2978,24 @@ define([
var body = $("<div>");
var title;
if (failed) {
title = "Notebook failed to load";
title = i18n.msg._("Notebook failed to load");
body.append($("<p>").text(
"The error was: "
i18n.msg._("The error was: ")
)).append($("<div>").addClass("js-error").text(
failed.toString()
)).append($("<p>").text(
"See the error console for details."
i18n.msg._("See the error console for details.")
));
} else {
title = "Notebook validation failed";
title = i18n.msg._("Notebook validation failed");
}
if (data.message) {
if (failed) {
msg = "The notebook also failed validation:";
msg = i18n.msg._("The notebook also failed validation:");
} else {
msg = "An invalid notebook may not function properly." +
" The validation error was:";
msg = i18n.msg._("An invalid notebook may not function properly." +
" The validation error was:");
}
body.append($("<p>").text(
msg
@ -3021,29 +3033,32 @@ define([
var orig_nbformat = nbmodel.metadata.orig_nbformat;
var orig_nbformat_minor = nbmodel.metadata.orig_nbformat_minor;
if (orig_nbformat !== undefined && nbmodel.nbformat !== orig_nbformat) {
var src;
var oldmsg = i18n.msg._("This notebook has been converted from an older notebook format" +
" to the current notebook format v(%s).");
var newmsg = i18n.msg._("This notebook has been converted from a newer notebook format" +
" to the current notebook format v(%s).");
if (nbmodel.nbformat > orig_nbformat) {
src = " an older notebook format ";
msg = i18n.msg.sprintf(oldmsg,nbmodel.nbformat);
} else {
src = " a newer notebook format ";
msg = i18n.msg.sprintf(newmsg,nbmodel.nbformat);
}
msg += " ";
msg += i18n.msg._("The next time you save this notebook, the " +
"current notebook format will be used.");
msg = "This notebook has been converted from" + src +
"(v"+orig_nbformat+") to the current notebook " +
"format (v"+nbmodel.nbformat+"). The next time you save this notebook, the " +
"current notebook format will be used.";
msg += " ";
if (nbmodel.nbformat > orig_nbformat) {
msg += " Older versions of Jupyter may not be able to read the new format.";
msg += i18n.msg._("Older versions of Jupyter may not be able to read the new format.");
} else {
msg += " Some features of the original notebook may not be available.";
msg += i18n.msg._("Some features of the original notebook may not be available.");
}
msg += " To preserve the original version, close the " +
"notebook without saving it.";
msg += " ";
msg += i18n.msg._("To preserve the original version, close the " +
"notebook without saving it.");
dialog.modal({
notebook: this,
keyboard_manager: this.keyboard_manager,
title : "Notebook converted",
title : i18n.msg._("Notebook converted"),
body : msg,
buttons : {
OK : {
@ -3065,7 +3080,7 @@ define([
// compat with IJulia, IHaskell, and other early kernels
// adopters that where setting a language metadata.
this.kernel_selector.set_kernel({
name: "(No name)",
name: i18n.msg._("(No name)"),
language: this.metadata.language
});
// this should be stored in kspec now, delete it.
@ -3113,9 +3128,9 @@ define([
var msg;
if (error.name === utils.XHR_ERROR && error.xhr.status === 500) {
utils.log_ajax_error(error.xhr, error.xhr_status, error.xhr_error);
msg = "An unknown error occurred while loading this notebook. " +
"This version can load notebook formats " +
"v" + this.nbformat + " or earlier. See the server log for details.";
msg = i18n.msg.sprintf(i18n.msg._("An unknown error occurred while loading this notebook. " +
"This version can load notebook formats %s or earlier. See the server log for details.",
"v" + this.nbformat));
} else {
msg = error.message;
console.warn('Error stack trace while loading notebook was:');
@ -3124,7 +3139,7 @@ define([
dialog.modal({
notebook: this,
keyboard_manager: this.keyboard_manager,
title: "Error loading notebook",
title: i18n.msg._("Error loading notebook"),
body : msg,
buttons : {
"OK": {}
@ -3225,15 +3240,13 @@ define([
}
var body = $('<div/>').append(
$('<p/>').addClass("p-space").text(
"Are you sure you want to revert the notebook to " +
"the latest checkpoint?"
i18n.msg._("Are you sure you want to revert the notebook to " +
"the latest checkpoint?")
).append(
$("<strong/>").text(
" This cannot be undone."
)
$("<strong/>").text(" "+i18n.msg._("This cannot be undone."))
)
).append(
$('<p/>').addClass("p-space").text("The checkpoint was last updated at:")
$('<p/>').addClass("p-space").text(i18n.msg._("The checkpoint was last updated at:"))
).append(
$('<p/>').addClass("p-space").text(
moment(checkpoint.last_modified).format('LLLL') +
@ -3244,7 +3257,7 @@ define([
dialog.modal({
notebook: this,
keyboard_manager: this.keyboard_manager,
title : "Revert notebook to checkpoint",
title : i18n.msg._("Revert notebook to checkpoint"),
body : body,
default_button: "Cancel",
buttons : {

@ -1,11 +1,13 @@
define([
'jquery',
'base/js/utils',
'base/js/i18n',
'base/js/dialog',
'base/js/notificationarea',
'moment'
], function($, utils, dialog, notificationarea, moment) {
], function($, utils, i18n, dialog, notificationarea, moment) {
"use strict";
var NotificationArea = notificationarea.NotificationArea;
var NotebookNotificationArea = function(selector, options) {
@ -72,36 +74,36 @@ define([
that.save_widget.update_document_title();
$body.addClass('edit_mode');
$body.removeClass('command_mode');
$modal_ind_icon.attr('title','Edit Mode');
$modal_ind_icon.attr('title',i18n.msg._('Edit Mode'));
});
this.events.on('command_mode.Notebook', function () {
that.save_widget.update_document_title();
$body.removeClass('edit_mode');
$body.addClass('command_mode');
$modal_ind_icon.attr('title','Command Mode');
$modal_ind_icon.attr('title',i18n.msg._('Command Mode'));
});
// Implicitly start off in Command mode, switching to Edit mode will trigger event
$modal_ind_icon.addClass('modal_indicator').attr('title','Command Mode');
$modal_ind_icon.addClass('modal_indicator').attr('title',i18n.msg._('Command Mode'));
$body.addClass('command_mode');
// Kernel events
// this can be either kernel_created.Kernel or kernel_created.Session
this.events.on('kernel_created.Kernel kernel_created.Session', function () {
knw.info("Kernel Created", 500);
knw.info(i18n.msg._("Kernel Created"), 500);
});
this.events.on('kernel_reconnecting.Kernel', function () {
knw.warning("Connecting to kernel");
knw.warning(i18n.msg._("Connecting to kernel"));
});
this.events.on('kernel_connection_dead.Kernel', function (evt, info) {
knw.danger("Not Connected", undefined, function () {
knw.danger(i18n.msg._("Not Connected"), undefined, function () {
// schedule reconnect a short time in the future, don't reconnect immediately
setTimeout($.proxy(info.kernel.reconnect, info.kernel), 500);
}, {title: 'click to reconnect'});
}, {title: i18n.msg._('click to reconnect')});
});
this.events.on('kernel_connected.Kernel', function () {
@ -110,7 +112,7 @@ define([
this.events.on('kernel_restarting.Kernel', function () {
that.save_widget.update_document_title();
knw.set_message("Restarting kernel", 2000);
knw.set_message(i18n.msg._("Restarting kernel"), 2000);
});
this.events.on('kernel_autorestarting.Kernel', function (evt, info) {
@ -124,8 +126,8 @@ define([
dialog.kernel_modal({
notebook: that.notebook,
keyboard_manager: that.keyboard_manager,
title: "Kernel Restarting",
body: "The kernel appears to have died. It will restart automatically.",
title: i18n.msg._("Kernel Restarting"),
body: i18n.msg._("The kernel appears to have died. It will restart automatically."),
buttons: {
OK : {
class : "btn-primary"
@ -135,18 +137,18 @@ define([
}
that.save_widget.update_document_title();
knw.danger("Dead kernel");
$kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead');
knw.danger(i18n.msg._("Dead kernel"));
$kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
});
this.events.on('kernel_interrupting.Kernel', function () {
knw.set_message("Interrupting kernel", 2000);
knw.set_message(i18n.msg._("Interrupting kernel"), 2000);
});
this.events.on('kernel_disconnected.Kernel', function () {
$kernel_ind_icon
.attr('class', 'kernel_disconnected_icon')
.attr('title', 'No Connection to Kernel');
.attr('title', i18n.msg._('No Connection to Kernel'));
});
this.events.on('kernel_connection_failed.Kernel', function (evt, info) {
@ -156,12 +158,12 @@ define([
// with messages
if (info.attempt === 1) {
var msg = "A connection to the notebook server could not be established." +
var msg = i18n.msg._("A connection to the notebook server could not be established." +
" The notebook will continue trying to reconnect. Check your" +
" network connection or notebook server configuration.";
" network connection or notebook server configuration.");
dialog.kernel_modal({
title: "Connection failed",
title: i18n.msg._("Connection failed"),
body: msg,
keyboard_manager: that.keyboard_manager,
notebook: that.notebook,
@ -174,22 +176,26 @@ define([
this.events.on('kernel_killed.Kernel kernel_killed.Session', function () {
that.save_widget.update_document_title();
knw.warning("No kernel");
$kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel is not running');
knw.warning(i18n.msg._("No kernel"));
$kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel is not running'));
});
this.events.on('kernel_dead.Kernel', function () {
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [ i18n.msg._("Don't Restart"), i18n.msg._("Try Restarting Now"), i18n.msg._("OK")];
var showMsg = function () {
var msg = 'The kernel has died, and the automatic restart has failed.' +
' It is possible the kernel cannot be restarted.' +
' If you are not able to restart the kernel, you will still be able to save' +
var msg = i18n.msg._('The kernel has died, and the automatic restart has failed.' +
' It is possible the kernel cannot be restarted. ' +
'If you are not able to restart the kernel, you will still be able to save' +
' the notebook, but running code will no longer work until the notebook' +
' is reopened.';
' is reopened.');
dialog.kernel_modal({
title: "Dead kernel",
title: i18n.msg._("Dead kernel"),
body : msg,
keyboard_manager: that.keyboard_manager,
notebook: that.notebook,
@ -209,14 +215,14 @@ define([
};
that.save_widget.update_document_title();
knw.danger("Dead kernel", undefined, showMsg);
$kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead');
knw.danger(i18n.msg._("Dead kernel"), undefined, showMsg);
$kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
showMsg();
});
this.events.on("no_kernel.Kernel", function (evt, data) {
$("#kernel_indicator").find('.kernel_indicator_name').text("No Kernel");
$("#kernel_indicator").find('.kernel_indicator_name').text(i18n.msg._("No Kernel"));
});
this.events.on('kernel_dead.Session', function (evt, info) {
@ -243,13 +249,13 @@ define([
}
dialog.kernel_modal({
title: "Failed to start the kernel",
title: i18n.msg._("Failed to start the kernel"),
body : msg,
keyboard_manager: that.keyboard_manager,
notebook: that.notebook,
open: cm_open,
buttons : {
"Ok": { class: 'btn-primary' }
"OK": { class: 'btn-primary' }
}
});
@ -257,46 +263,47 @@ define([
};
that.save_widget.update_document_title();
$kernel_ind_icon.attr('class','kernel_dead_icon').attr('title','Kernel Dead');
$kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
knw.danger(short, undefined, showMsg);
});
this.events.on('kernel_starting.Kernel kernel_created.Session', function () {
// window.document.title='(Starting) '+window.document.title;
$kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy');
knw.set_message("Kernel starting, please wait...");
$kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
knw.set_message(i18n.msg._("Kernel starting, please wait..."));
set_busy_favicon(true);
});
this.events.on('kernel_ready.Kernel', function () {
// that.save_widget.update_document_title();
$kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle');
knw.info("Kernel ready", 500);
$kernel_ind_icon.attr('class','kernel_idle_icon').attr('title',i18n.msg._('Kernel Idle'));
knw.info(i18n.msg._("Kernel ready"), 500);
set_busy_favicon(false);
});
this.events.on('kernel_idle.Kernel', function () {
// that.save_widget.update_document_title();
$kernel_ind_icon.attr('class','kernel_idle_icon').attr('title','Kernel Idle');
$kernel_ind_icon.attr('class','kernel_idle_icon').attr('title',i18n.msg._('Kernel Idle'));
set_busy_favicon(false);
});
this.events.on('kernel_busy.Kernel', function () {
// window.document.title='(Busy) '+window.document.title;
$kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy');
$kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
set_busy_favicon(true);
});
this.events.on('spec_match_found.Kernel', function (evt, data) {
that.widget('kernelspec').info("Using kernel: " + data.found.spec.display_name, 3000, undefined, {
title: "Only candidate for language: " + data.selected.language + " was " + data.found.spec.display_name
that.widget('kernelspec').info(i18n.msg._("Using kernel: ") + data.found.spec.display_name, 3000, undefined, {
title: i18n.msg.sprintf(i18n.msg._("Only candidate for language: %1$s was %2$s."),
data.selected.language, data.found.spec.display_name)
});
});
// Start the kernel indicator in the busy state, and send a kernel_info request.
// When the kernel_info reply arrives, the kernel is idle.
$kernel_ind_icon.attr('class','kernel_busy_icon').attr('title','Kernel Busy');
$kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
};
/**
@ -309,27 +316,27 @@ define([
// Notebook events
this.events.on('notebook_loading.Notebook', function () {
nnw.set_message("Loading notebook",500);
nnw.set_message(i18n.msg._("Loading notebook"),500);
});
this.events.on('notebook_loaded.Notebook', function () {
nnw.set_message("Notebook loaded",500);
nnw.set_message(i18n.msg._("Notebook loaded"),500);
});
this.events.on('notebook_saving.Notebook', function () {
nnw.set_message("Saving notebook",500);
nnw.set_message(i18n.msg._("Saving notebook"),500);
});
this.events.on('notebook_saved.Notebook', function () {
nnw.set_message("Notebook saved",2000);
nnw.set_message(i18n.msg._("Notebook saved"),2000);
});
this.events.on('notebook_save_failed.Notebook', function (evt, error) {
nnw.warning(error.message || "Notebook save failed");
nnw.warning(error.message || i18n.msg._("Notebook save failed"));
});
this.events.on('notebook_copy_failed.Notebook', function (evt, error) {
nnw.warning(error.message || "Notebook copy failed");
nnw.warning(error.message || i18n.msg._("Notebook copy failed"));
});
// Checkpoint events
this.events.on('checkpoint_created.Notebook', function (evt, data) {
var msg = "Checkpoint created";
var msg = i18n.msg._("Checkpoint created");
if (data.last_modified) {
var d = new Date(data.last_modified);
msg = msg + ": " + moment(d).format("HH:mm:ss");
@ -337,27 +344,27 @@ define([
nnw.set_message(msg, 2000);
});
this.events.on('checkpoint_failed.Notebook', function () {
nnw.warning("Checkpoint failed");
nnw.warning(i18n.msg._("Checkpoint failed"));
});
this.events.on('checkpoint_deleted.Notebook', function () {
nnw.set_message("Checkpoint deleted", 500);
nnw.set_message(i18n.msg._("Checkpoint deleted"), 500);
});
this.events.on('checkpoint_delete_failed.Notebook', function () {
nnw.warning("Checkpoint delete failed");
nnw.warning(i18n.msg._("Checkpoint delete failed"));
});
this.events.on('checkpoint_restoring.Notebook', function () {
nnw.set_message("Restoring to checkpoint...", 500);
nnw.set_message(i18n.msg._("Restoring to checkpoint..."), 500);
});
this.events.on('checkpoint_restore_failed.Notebook', function () {
nnw.warning("Checkpoint restore failed");
nnw.warning(i18n.msg._("Checkpoint restore failed"));
});
// Autosave events
this.events.on('autosave_disabled.Notebook', function () {
nnw.set_message("Autosave disabled", 2000);
nnw.set_message(i18n.msg._("Autosave disabled"), 2000);
});
this.events.on('autosave_enabled.Notebook', function (evt, interval) {
nnw.set_message("Saving every " + interval / 1000 + "s", 1000);
nnw.set_message(i18n.msg.sprintf(i18n.msg._("Saving every %d sec."), interval / 1000) , 1000);
});
};
@ -373,9 +380,9 @@ define([
// Notebook trust events
this.events.on('trust_changed.Notebook', function (event, trusted) {
if (trusted) {
tnw.set_message("Trusted");
tnw.set_message(i18n.msg._("Trusted"));
} else {
tnw.set_message("Not Trusted", undefined, function() {
tnw.set_message(i18n.msg._("Not Trusted"), undefined, function() {
that.notebook.trust_notebook();
return false;
});

@ -4,12 +4,13 @@
define([
'jquery',
'base/js/utils',
'base/js/i18n',
'base/js/security',
'base/js/keyboard',
'services/config',
'notebook/js/mathjaxutils',
'components/marked/lib/marked',
], function($, utils, security, keyboard, configmod, mathjaxutils, marked) {
], function($, utils, i18n, security, keyboard, configmod, mathjaxutils, marked) {
"use strict";
/**
@ -82,11 +83,11 @@ define([
this.element.addClass('output');
this.collapse_button.addClass("btn btn-default output_collapsed");
this.collapse_button.attr('title', 'click to expand output');
this.collapse_button.attr('title', i18n.msg._('click to expand output'));
this.collapse_button.text('. . .');
this.prompt_overlay.addClass('out_prompt_overlay prompt');
this.prompt_overlay.attr('title', 'click to expand output; double click to hide output');
this.prompt_overlay.attr('title', i18n.msg._('click to expand output; double click to hide output'));
this.expand();
};
@ -174,14 +175,14 @@ define([
OutputArea.prototype.scroll_area = function () {
this.element.addClass('output_scroll');
this.prompt_overlay.attr('title', 'click to unscroll output; double click to hide');
this.prompt_overlay.attr('title', i18n.msg._('click to unscroll output; double click to hide'));
this.scrolled = true;
};
OutputArea.prototype.unscroll_area = function () {
this.element.removeClass('output_scroll');
this.prompt_overlay.attr('title', 'click to scroll output; double click to hide');
this.prompt_overlay.attr('title', i18n.msg._('click to scroll output; double click to hide'));
this.scrolled = false;
};
@ -429,12 +430,12 @@ define([
/**
* display a message when a javascript error occurs in display output
*/
var msg = "Javascript error adding output!";
var msg = i18n.msg._("Javascript error adding output!");
if ( element === undefined ) return;
element
.append($('<div/>').text(msg).addClass('js-error'))
.append($('<div/>').text(err.toString()).addClass('js-error'))
.append($('<div/>').text('See your browser Javascript console for more details.').addClass('js-error'));
.append($('<div/>').text(i18n.msg._('See your browser Javascript console for more details.')).addClass('js-error'));
};
OutputArea.prototype._safe_append = function (toinsert, toreplace) {
@ -475,9 +476,7 @@ define([
.addClass('output_prompt')
.empty()
.append(
$('<bdi>').text('Out')
).append(
'[' + n + ']:'
$('<bdi>').text(i18n.msg.sprintf(i18n.msg._('Out[%d]:'),n))
);
}
var inserted = this.append_mime_type(json, toinsert);
@ -586,7 +585,7 @@ define([
subarea.append(
$("<a>")
.attr("href", "#")
.text("Unrecognized output: " + json.output_type)
.text(i18n.msg.sprintf(i18n.msg._("Unrecognized output: %s"),json.output_type))
.click(function () {
that.events.trigger('unrecognized_output.OutputArea', {output: json});
})

@ -4,8 +4,9 @@
define([
'jquery',
'base/js/utils',
'base/js/i18n',
'jquery-ui'
], function($, utils) {
], function($, utils, i18n) {
"use strict";
var Pager = function (pager_selector, options) {
@ -32,7 +33,7 @@ define([
var that = this;
this.pager_button_area.append(
$('<a>').attr('role', "button")
.attr('title',"Open the pager in an external window")
.attr('title',i18n.msg._("Open the pager in an external window"))
.addClass('ui-button')
.click(function(){that.detach();})
.append(
@ -41,7 +42,7 @@ define([
);
this.pager_button_area.append(
$('<a>').attr('role', "button")
.attr('title',"Close the pager")
.attr('title',i18n.msg._("Close the pager"))
.addClass('ui-button')
.click(function(){that.collapse();})
.append(
@ -144,7 +145,7 @@ define([
.attr('type',"text/css")
)
.append(
$('<title>').text("Jupyter Pager")
$('<title>').text(i18n.msg._("Jupyter Pager"))
);
var pager_body = $(w.document.body);
pager_body.css('overflow','scroll');

@ -4,10 +4,12 @@
define([
'jquery',
'base/js/utils',
'base/js/i18n',
'base/js/dialog',
'underscore'
], function($, utils, dialog, _) {
], function($, utils, i18n, dialog, _) {
"use strict";
var platform = utils.platform;
var QuickHelp = function (options) {
@ -34,36 +36,36 @@ define([
// Mac OS X specific
cmd_ctrl = 'Cmd-';
platform_specific = [
{ shortcut: "Cmd-Up", help:"go to cell start" },
{ shortcut: "Cmd-Down", help:"go to cell end" },
{ shortcut: "Alt-Left", help:"go one word left" },
{ shortcut: "Alt-Right", help:"go one word right" },
{ shortcut: "Alt-Backspace", help:"delete word before" },
{ shortcut: "Alt-Delete", help:"delete word after" },
{ shortcut: "Cmd-Up", help:i18n.msg._("go to cell start") },
{ shortcut: "Cmd-Down", help:i18n.msg._("go to cell end") },
{ shortcut: "Alt-Left", help:i18n.msg._("go one word left") },
{ shortcut: "Alt-Right", help:i18n.msg._("go one word right") },
{ shortcut: "Alt-Backspace", help:i18n.msg._("delete word before") },
{ shortcut: "Alt-Delete", help:i18n.msg._("delete word after") },
];
} else {
// PC specific
platform_specific = [
{ shortcut: "Ctrl-Home", help:"go to cell start" },
{ shortcut: "Ctrl-Up", help:"go to cell start" },
{ shortcut: "Ctrl-End", help:"go to cell end" },
{ shortcut: "Ctrl-Down", help:"go to cell end" },
{ shortcut: "Ctrl-Left", help:"go one word left" },
{ shortcut: "Ctrl-Right", help:"go one word right" },
{ shortcut: "Ctrl-Backspace", help:"delete word before" },
{ shortcut: "Ctrl-Delete", help:"delete word after" },
{ shortcut: "Ctrl-Home", help:i18n.msg._("go to cell start") },
{ shortcut: "Ctrl-Up", help:i18n.msg._("go to cell start") },
{ shortcut: "Ctrl-End", help:i18n.msg._("go to cell end") },
{ shortcut: "Ctrl-Down", help:i18n.msg._("go to cell end") },
{ shortcut: "Ctrl-Left", help:i18n.msg._("go one word left") },
{ shortcut: "Ctrl-Right", help:i18n.msg._("go one word right") },
{ shortcut: "Ctrl-Backspace", help:i18n.msg._("delete word before") },
{ shortcut: "Ctrl-Delete", help:i18n.msg._("delete word after") },
];
}
var cm_shortcuts = [
{ shortcut:"Tab", help:"code completion or indent" },
{ shortcut:"Shift-Tab", help:"tooltip" },
{ shortcut: cmd_ctrl + "]", help:"indent" },
{ shortcut: cmd_ctrl + "[", help:"dedent" },
{ shortcut: cmd_ctrl + "a", help:"select all" },
{ shortcut: cmd_ctrl + "z", help:"undo" },
{ shortcut: cmd_ctrl + "Shift-z", help:"redo" },
{ shortcut: cmd_ctrl + "y", help:"redo" },
{ shortcut:"Tab", help:i18n.msg._("code completion or indent") },
{ shortcut:"Shift-Tab", help:i18n.msg._("tooltip") },
{ shortcut: cmd_ctrl + "]", help:i18n.msg._("indent") },
{ shortcut: cmd_ctrl + "[", help:i18n.msg._("dedent") },
{ shortcut: cmd_ctrl + "a", help:i18n.msg._("select all") },
{ shortcut: cmd_ctrl + "z", help:i18n.msg._("undo") },
{ shortcut: cmd_ctrl + "Shift-z", help:i18n.msg._("redo") },
{ shortcut: cmd_ctrl + "y", help:i18n.msg._("redo") },
].concat( platform_specific );
var mac_humanize_map = {
@ -97,24 +99,24 @@ define([
};
var default_humanize_map = {
'shift':'Shift',
'alt':'Alt',
'up':'Up',
'down':'Down',
'left':'Left',
'right':'Right',
'tab':'Tab',
'capslock':'Caps Lock',
'esc':'Esc',
'ctrl':'Ctrl',
'enter':'Enter',
'pageup':'Page Up',
'pagedown':'Page Down',
'home':'Home',
'end':'End',
'space':'Space',
'backspace':'Backspace',
'-':'Minus'
'shift':i18n.msg._('Shift'),
'alt':i18n.msg._('Alt'),
'up':i18n.msg._('Up'),
'down':i18n.msg._('Down'),
'left':i18n.msg._('Left'),
'right':i18n.msg._('Right'),
'tab':i18n.msg._('Tab'),
'capslock':i18n.msg._('Caps Lock'),
'esc':i18n.msg._('Esc'),
'ctrl':i18n.msg._('Ctrl'),
'enter':i18n.msg._('Enter'),
'pageup':i18n.msg._('Page Up'),
'pagedown':i18n.msg._('Page Down'),
'home':i18n.msg._('Home'),
'end':i18n.msg._('End'),
'space':i18n.msg._('Space'),
'backspace':i18n.msg._('Backspace'),
'-':i18n.msg._('Minus')
};
var humanize_map;
@ -125,7 +127,7 @@ define([
humanize_map = default_humanize_map;
}
var special_case = { pageup: "PageUp", pagedown: "Page Down" };
var special_case = { pageup: i18n.msg._("PageUp"), pagedown: i18n.msg._("Page Down") };
function humanize_key(key){
if (key.length === 1){
@ -192,11 +194,11 @@ define([
// The documentation
var doc = $('<div/>').addClass('alert alert-info');
doc.append(
'The Jupyter Notebook has two different keyboard input modes. <b>Edit mode</b> '+
'allows you to type code/text into a cell and is indicated by a green cell '+
'border. <b>Command mode</b> binds the keyboard to notebook level commands '+
'and is indicated by a grey cell border with a blue left margin.'
doc.append(i18n.msg._('The Jupyter Notebook has two different keyboard input modes.'))
.append(' ')
.append(i18n.msg._('<b>Edit mode</b> allows you to type code or text into a cell and is indicated by a green cell border.'))
.append(' ')
.append(i18n.msg._('<b>Command mode</b> binds the keyboard to notebook level commands and is indicated by a grey cell border with a blue left margin.')
);
element.append(doc);
if (platform === 'MacOS') {
@ -214,8 +216,13 @@ define([
var edit_div = this.build_edit_help(cm_shortcuts);
element.append(edit_div);
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [ i18n.msg._("Close") ];
this.shortcut_dialog = dialog.modal({
title : "Keyboard shortcuts",
title : i18n.msg._("Keyboard shortcuts"),
body : element,
destroy : false,
buttons : {
@ -230,13 +237,13 @@ define([
};
QuickHelp.prototype.build_key_names = function () {
var key_names_mac = [{ shortcut:"⌘", help:"Command" },
{ shortcut:"⌃", help:"Control" },
{ shortcut:"⌥", help:"Option" },
{ shortcut:"⇧", help:"Shift" },
{ shortcut:"↩", help:"Return" },
{ shortcut:"␣", help:"Space" },
{ shortcut:"⇥", help:"Tab" }];
var key_names_mac = [{ shortcut:"⌘", help:i18n.msg._("Command") },
{ shortcut:"⌃", help:i18n.msg._("Control") },
{ shortcut:"⌥", help:i18n.msg._("Option") },
{ shortcut:"⇧", help:i18n.msg._("Shift") },
{ shortcut:"↩", help:i18n.msg._("Return") },
{ shortcut:"␣", help:i18n.msg._("Space") },
{ shortcut:"⇥", help:i18n.msg._("Tab") }];
var i, half, n;
var div = $('<div/>').append('Mac OS X modifier keys:');
var sub_div = $('<div/>').addClass('container-fluid');
@ -259,12 +266,13 @@ define([
QuickHelp.prototype.build_command_help = function () {
var that = this;
var command_shortcuts = this.keyboard_manager.command_shortcuts.help();
var div = build_div('<h4>Command Mode (press <kbd>Esc</kbd> to enable)</h4>', command_shortcuts);
var cmdkey = '<kbd>'+i18n.msg._('Esc')+'</kbd>';
var div = build_div('<h4>'+i18n.msg.sprintf(i18n.msg._('Command Mode (press %s to enable)'),cmdkey)+'</h4>', command_shortcuts);
var edit_button = $('<button/>')
.text("Edit Shortcuts")
.text(i18n.msg._("Edit Shortcuts"))
.addClass('btn btn-xs btn-default pull-right')
.attr('href', '#')
.attr('title', 'edit command-mode keyboard shortcuts')
.attr('title', i18n.msg._('edit command-mode keyboard shortcuts'))
.click(function () {
// close this dialog
$(that.shortcut_dialog).modal("toggle");
@ -279,8 +287,9 @@ define([
QuickHelp.prototype.build_edit_help = function (cm_shortcuts) {
var edit_shortcuts = this.keyboard_manager.edit_shortcuts.help();
var enterkey = '<kbd>'+i18n.msg._('Enter')+'</kbd>';
edit_shortcuts = $.merge($.merge([], cm_shortcuts), edit_shortcuts);
return build_div('<h4>Edit Mode (press <kbd>Enter</kbd> to enable)</h4>', edit_shortcuts);
return build_div('<h4>'+i18n.msg.sprintf(i18n.msg._('Edit Mode (press %s to enable)'),enterkey)+'</h4>', edit_shortcuts);
};
var build_one = function (s) {

@ -4,10 +4,11 @@
define([
'jquery',
'base/js/utils',
'base/js/i18n',
'base/js/dialog',
'base/js/keyboard',
'moment',
], function($, utils, dialog, keyboard, moment) {
], function($, utils, i18n, dialog, keyboard, moment) {
"use strict";
var SaveWidget = function (selector, options) {
@ -45,7 +46,7 @@ define([
that.update_address_bar();
});
this.events.on('notebook_save_failed.Notebook', function () {
that.set_save_status('Autosave Failed!');
that.set_save_status(i18n.msg._('Autosave Failed!'));
});
this.events.on('notebook_read_only.Notebook', function () {
that.set_save_status('(read only)');
@ -64,13 +65,17 @@ define([
});
};
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [ i18n.msg._("Cancel"), i18n.msg._("Rename"), i18n.msg._("OK")];
SaveWidget.prototype.rename_notebook = function (options) {
options = options || {};
var that = this;
var dialog_body = $('<div/>').append(
$("<p/>").addClass("rename-message")
.text('Enter a new notebook name:')
.text(i18n.msg._('Enter a new notebook name:'))
).append(
$("<br/>")
).append(
@ -78,7 +83,7 @@ define([
.val(options.notebook.get_notebook_name())
);
var d = dialog.modal({
title: "Rename Notebook",
title: i18n.msg._("Rename Notebook"),
body: dialog_body,
notebook: options.notebook,
keyboard_manager: this.keyboard_manager,
@ -90,20 +95,18 @@ define([
click: function () {
var new_name = d.find('input').val();
if (!options.notebook.test_notebook_name(new_name)) {
d.find('.rename-message').text(
"Invalid notebook name. Notebook names must "+
"have 1 or more characters and can contain any characters " +
"except :/\\. Please enter a new notebook name:"
d.find('.rename-message').text(i18n.msg._(
"Invalid notebook name. Notebook names must have 1 or more characters and can contain any characters except :/\\. Please enter a new notebook name:")
);
return false;
} else {
d.find('.rename-message').text("Renaming...");
d.find('.rename-message').text(i18n.msg._("Renaming..."));
d.find('input[type="text"]').prop('disabled', true);
that.notebook.rename(new_name).then(
function () {
d.modal('hide');
}, function (error) {
d.find('.rename-message').text(error.message || 'Unknown error');
d.find('.rename-message').text(error.message || i18n.msg._('Unknown error'));
d.find('input[type="text"]').prop('disabled', false).focus().select();
}
);
@ -172,7 +175,7 @@ define([
this._schedule_render_checkpoint();
var el = this.element.find('span.checkpoint_status');
if (!this._checkpoint_date) {
el.text('').attr('title', 'no checkpoint');
el.text('').attr('title', i18n.msg._('no checkpoint'));
return;
}
var chkd = moment(this._checkpoint_date);
@ -187,7 +190,7 @@ define([
// <Today | yesterday|...> at hh,mm,ss
human_date = chkd.calendar();
}
el.text('Last Checkpoint: ' + human_date).attr('title', long_date);
el.text(i18n.msg.sprintf(i18n.msg._('Last Checkpoint: %s'),human_date)).attr('title', long_date);
};
@ -211,9 +214,9 @@ define([
SaveWidget.prototype.set_autosaved = function (dirty) {
if (dirty) {
this.set_save_status("(unsaved changes)");
this.set_save_status(i18n.msg._("(unsaved changes)"));
} else {
this.set_save_status("(autosaved)");
this.set_save_status(i18n.msg._("(autosaved)"));
}
};

@ -1,9 +1,10 @@
define(function(require){
define([
'jquery',
'base/js/dialog',
'base/js/i18n'
], function($, dialog, i18n){
"use strict";
var $ = require('jquery');
var dialog = require('base/js/dialog');
/**
* escape a Regular expression to act as a pure search string.
* though it will still have the case sensitivity options and all
@ -67,9 +68,11 @@ define(function(require){
var build_preview = function(body, aborted, html, replace){
body.empty();
if(aborted){
body.append($('<p/>').addClass('bg-warning').text("Warning, too many matches ("+html.length+"+), some changes might not be shown or applied"));
var warnmsg = i18n.msg.sprintf(i18n.msg._("Warning: too many matches (%d). Some changes might not be shown or applied."),html.length);
body.append($('<p/>').addClass('bg-warning').text(warnmsg));
} else {
body.append($('<p/>').text(html.length+" match"+(html.length==1?'':'es')));
var matchmsg = i18n.msg.sprintf(i18n.msg.ngettext("%d match","%d matches",html.length),html.length);
body.append($('<p/>').text(matchmsg));
}
for(var rindex=0; rindex<html.length; rindex++){
var pre = $('<pre/>')
@ -135,7 +138,7 @@ define(function(require){
res.push([match.index, match.index+match[0].length]);
escape_hatch++;
if(escape_hatch > 100){
console.warn("More than 100 matches, aborting");
console.warn(i18n.msg._("More than 100 matches, aborting"));
abort = true;
break;
}
@ -155,7 +158,7 @@ define(function(require){
.addClass("btn btn-default btn-sm")
.attr('data-toggle','button')
.css('font-weight', 'bold')
.attr('title', 'Use regex (JavaScript regex syntax)')
.attr('title', i18n.msg._('Use regex (JavaScript regex syntax)'))
.text('.*');
var allCellsButton = $('<button/>')
@ -163,20 +166,20 @@ define(function(require){
.attr('type', 'button')
.addClass("btn btn-default btn-sm")
.attr('data-toggle','button')
.attr('title', 'Replace in all cells');
.attr('title', i18n.msg._('Replace in selected cells'));
var isCaseSensitiveButton = $('<button/>')
.attr('type', 'button')
.addClass("btn btn-default btn-sm")
.attr('data-toggle','button')
.attr('tabindex', '0')
.attr('title', 'Match case')
.attr('title', i18n.msg._('Match case'))
.css('font-weight', 'bold')
.text('Aa');
var search = $("<input/>")
.addClass('form-control input-sm')
.attr('placeholder','Find');
.attr('placeholder',i18n.msg._('Find'));
var findFormGroup = $('<div/>').addClass('form-group');
findFormGroup.append(
@ -192,7 +195,7 @@ define(function(require){
var replace = $("<input/>")
.addClass('form-control input-sm')
.attr('placeholder','Replace');
.attr('placeholder',i18n.msg._('Replace'));
var replaceFormGroup = $('<div/>').addClass('form-group');
replaceFormGroup.append(replace);
@ -238,7 +241,7 @@ define(function(require){
var onError = function(body){
body.empty();
body.append($('<p/>').text('No matches, invalid or empty regular expression'));
body.append($('<p/>').text(i18n.msg._('No matches, invalid or empty regular expression')));
};
var get_cells = function(env){
@ -339,10 +342,14 @@ define(function(require){
search.on('input', onChange);
replace.on('input', onChange);
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [ i18n.msg._("Replace All")];
var mod = dialog.modal({
show: false,
title: "Find and Replace",
title: i18n.msg._("Find and Replace"),
body:form,
keyboard_manager: env.notebook.keyboard_manager,
buttons:{
@ -367,7 +374,8 @@ define(function(require){
var load = function(keyboard_manager){
var action_all = {
help: 'find and replace',
cmd: i18n.msg._('find and replace'),
help: i18n.msg._('find and replace'),
handler: function(env, event){
snr(env, event);
}

@ -4,6 +4,7 @@
define([
'jquery',
'base/js/utils',
'base/js/i18n',
'notebook/js/cell',
'base/js/security',
'services/config',
@ -16,6 +17,7 @@ define([
], function(
$,
utils,
i18n,
cell,
security,
configmod,
@ -546,9 +548,9 @@ define([
highlight_modes : {
'diff' :{'reg':[/^diff/]}
},
placeholder : "Write raw LaTeX or other formats here, for use with nbconvert. " +
placeholder : i18n.msg._("Write raw LaTeX or other formats here, for use with nbconvert. " +
"It will not be rendered in the notebook. " +
"When passing through nbconvert, a Raw Cell's content is added to the output unmodified.",
"When passing through nbconvert, a Raw Cell's content is added to the output unmodified."),
};
RawCell.prototype = Object.create(TextCell.prototype);

@ -1,7 +1,7 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['jquery'], function($) {
define(['jquery','base/js/i18n'], function($, i18n) {
"use strict";
/**
@ -94,12 +94,12 @@ define(['jquery'], function($) {
}
var button = $('<button/>')
.addClass('btn btn-default')
.attr("title", el.label||action.help)
.attr("title", el.label||i18n.msg._(action.help))
.append(
$("<i/>").addClass(el.icon||(action||{icon:'fa-exclamation-triangle'}).icon).addClass('fa')
);
if (el.label) {
var label = $('<span/>').text(el.label).addClass('toolbar-btn-label');
var label = $('<span/>').text(i18n.msg._(el.label)).addClass('toolbar-btn-label');
button.append(label);
}
var id = el.id;

@ -4,7 +4,8 @@
define([
'jquery',
'base/js/utils',
], function($, utils) {
'base/js/i18n'
], function($, utils, i18n) {
"use strict";
// tooltip constructor
@ -37,15 +38,15 @@ define([
// build the buttons menu on the upper right
// expand the tooltip to see more
var expandlink = $('<a/>').attr('href', "#").addClass("ui-corner-all") //rounded corner
.attr('role', "button").attr('id', 'expanbutton').attr('title', 'Grow the tooltip vertically (press shift-tab twice)').click(function () {
.attr('role', "button").attr('id', 'expanbutton').attr('title', i18n.msg._('Grow the tooltip vertically (press shift-tab twice)')).click(function () {
that.expand();
event.preventDefault();
}).append(
$('<span/>').text('Expand').addClass('ui-icon').addClass('ui-icon-plus'));
// open in pager
var morelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button').attr('title', 'show the current docstring in pager (press shift-tab 4 times)');
var morespan = $('<span/>').text('Open in Pager').addClass('ui-icon').addClass('ui-icon-arrowstop-l-n');
var morelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button').attr('title', i18n.msg._('show the current docstring in pager (press shift-tab 4 times)'));
var morespan = $('<span/>').text(i18n.msg._('Open in Pager')).addClass('ui-icon').addClass('ui-icon-arrowstop-l-n');
morelink.append(morespan);
morelink.click(function () {
that.showInPager(that._old_cell);
@ -54,7 +55,7 @@ define([
// close the tooltip
var closelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button');
var closespan = $('<span/>').text('Close').addClass('ui-icon').addClass('ui-icon-close');
var closespan = $('<span/>').text(i18n.msg._('Close')).addClass('ui-icon').addClass('ui-icon-close');
closelink.append(closespan);
closelink.click(function () {
that.remove_and_cancel_tooltip(true);
@ -64,8 +65,8 @@ define([
this._clocklink = $('<a/>').attr('href', "#");
this._clocklink.attr('role', "button");
this._clocklink.addClass('ui-button');
this._clocklink.attr('title', 'Tooltip will linger for 10 seconds while you type');
var clockspan = $('<span/>').text('Close');
this._clocklink.attr('title', i18n.msg._('Tooltip will linger for 10 seconds while you type'));
var clockspan = $('<span/>').text(i18n.msg._('Close'));
clockspan.addClass('ui-icon');
clockspan.addClass('ui-icon-clock');
this._clocklink.append(clockspan);

@ -1,7 +1,7 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
define(['jquery', 'bootstraptour'], function($, Tour) {
define(['jquery', 'bootstraptour', 'base/js/i18n'], function($, Tour, i18n) {
"use strict";
var tour_style = "<div class='popover tour'>\n" +
@ -24,59 +24,59 @@ define(['jquery', 'bootstraptour'], function($, Tour) {
this.events = events;
this.tour_steps = [
{
title: "Welcome to the Notebook Tour",
title: i18n.msg._("Welcome to the Notebook Tour"),
placement: 'bottom',
orphan: true,
content: "You can use the left and right arrow keys to go backwards and forwards."
content: i18n.msg._("You can use the left and right arrow keys to go backwards and forwards.")
}, {
element: "#notebook_name",
title: "Filename",
title: i18n.msg._("Filename"),
placement: 'bottom',
content: "Click here to change the filename for this notebook."
content: i18n.msg._("Click here to change the filename for this notebook.")
}, {
element: $("#menus").parent(),
placement: 'bottom',
title: "Notebook Menubar",
content: "The menubar has menus for actions on the notebook, its cells, and the kernel it communicates with."
title: i18n.msg._("Notebook Menubar"),
content: i18n.msg._("The menubar has menus for actions on the notebook, its cells, and the kernel it communicates with.")
}, {
element: "#maintoolbar",
placement: 'bottom',
title: "Notebook Toolbar",
content: "The toolbar has buttons for the most common actions. Hover your mouse over each button for more information."
title: i18n.msg._("Notebook Toolbar"),
content: i18n.msg._("The toolbar has buttons for the most common actions. Hover your mouse over each button for more information.")
}, {
element: "#modal_indicator",
title: "Mode Indicator",
title: i18n.msg._("Mode Indicator"),
placement: 'bottom',
content: "The Notebook has two modes: Edit Mode and Command Mode. In this area, an indicator can appear to tell you which mode you are in.",
content: i18n.msg._("The Notebook has two modes: Edit Mode and Command Mode. In this area, an indicator can appear to tell you which mode you are in."),
onShow: function(tour) { that.command_icon_hack(); }
}, {
element: "#modal_indicator",
title: "Command Mode",
title: i18n.msg._("Command Mode"),
placement: 'bottom',
onShow: function(tour) { notebook.command_mode(); that.command_icon_hack(); },
onNext: function(tour) { that.edit_mode(); },
content: "Right now you are in Command Mode, and many keyboard shortcuts are available. In this mode, no icon is displayed in the indicator area."
content: i18n.msg._("Right now you are in Command Mode, and many keyboard shortcuts are available. In this mode, no icon is displayed in the indicator area.")
}, {
element: "#modal_indicator",
title: "Edit Mode",
title: i18n.msg._("Edit Mode"),
placement: 'bottom',
onShow: function(tour) { that.edit_mode(); },
content: "Pressing <code>Enter</code> or clicking in the input text area of the cell switches to Edit Mode."
content: i18n.msg._("Pressing <code>Enter</code> or clicking in the input text area of the cell switches to Edit Mode.")
}, {
element: '.selected',
title: "Edit Mode",
title: i18n.msg._("Edit Mode"),
placement: 'bottom',
onShow: function(tour) { that.edit_mode(); },
content: "Notice that the border around the currently active cell changed color. Typing will insert text into the currently active cell."
content: i18n.msg._("Notice that the border around the currently active cell changed color. Typing will insert text into the currently active cell.")
}, {
element: '.selected',
title: "Back to Command Mode",
title: i18n.msg._("Back to Command Mode"),
placement: 'bottom',
onShow: function(tour) { notebook.command_mode(); },
content: "Pressing <code>Esc</code> or clicking outside of the input text area takes you back to Command Mode."
content: i18n.msg._("Pressing <code>Esc</code> or clicking outside of the input text area takes you back to Command Mode.")
}, {
element: '#keyboard_shortcuts',
title: "Keyboard Shortcuts",
title: i18n.msg._("Keyboard Shortcuts"),
placement: 'bottom',
onShow: function(tour) {
/** need to add `open` and `pulse` classes in 2 calls */
@ -88,36 +88,36 @@ define(['jquery', 'bootstraptour'], function($, Tour) {
$('#help_menu').parent().removeClass('open pulse');
$('#keyboard_shortcuts').removeClass('pulse');
},
content: "You can click here to get a list of all of the keyboard shortcuts."
content: i18n.msg._("You can click here to get a list of all of the keyboard shortcuts.")
}, {
element: "#kernel_indicator_icon",
title: "Kernel Indicator",
title: i18n.msg._("Kernel Indicator"),
placement: 'bottom',
onShow: function(tour) { events.trigger('kernel_idle.Kernel');},
content: "This is the Kernel indicator. It looks like this when the Kernel is idle."
content: i18n.msg._("This is the Kernel indicator. It looks like this when the Kernel is idle.")
}, {
element: "#kernel_indicator_icon",
title: "Kernel Indicator",
title: i18n.msg._("Kernel Indicator"),
placement: 'bottom',
onShow: function(tour) { events.trigger('kernel_busy.Kernel'); },
content: "The Kernel indicator looks like this when the Kernel is busy."
content: i18n.msg._("The Kernel indicator looks like this when the Kernel is busy.")
}, {
element: ".fa-stop",
placement: 'bottom',
title: "Interrupting the Kernel",
title: i18n.msg._("Interrupting the Kernel"),
onHide: function(tour) { events.trigger('kernel_idle.Kernel'); },
content: "To cancel a computation in progress, you can click here."
content: i18n.msg._("To cancel a computation in progress, you can click here.")
}, {
element: "#notification_kernel",
placement: 'bottom',
onShow: function(tour) { $('.fa-stop').click(); },
title: "Notification Area",
content: "Messages in response to user actions (Save, Interrupt, etc) appear here."
title: i18n.msg._("Notification Area"),
content: i18n.msg._("Messages in response to user actions (Save, Interrupt, etc.) appear here.")
}, {
title: "Fin.",
title: i18n.msg._("End of Tour"),
placement: 'bottom',
orphan: true,
content: "This concludes the Jupyter Notebook User Interface Tour. Happy hacking!"
content: i18n.msg._("This concludes the Jupyter Notebook User Interface Tour.")
}
];

@ -5,9 +5,10 @@ define([
'jquery',
'base/js/namespace',
'tree/js/notebooklist',
], function($, IPython, notebooklist) {
'base/js/i18n'
], function($, IPython, notebooklist, i18n) {
"use strict";
var KernelList = function (selector, options) {
/**
* Constructor
@ -82,7 +83,7 @@ define([
var shutdown_button = $('<button/>')
.addClass('btn btn-warning btn-xs')
.text('Shutdown')
.text(i18n._('Shutdown'))
.click(function() {
var path = $(this).parent().parent().parent().data('path');
that.shutdown_notebook(path);

@ -5,8 +5,9 @@ define([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/i18n',
'base/js/dialog',
], function ($, IPython, utils, dialog) {
], function ($, IPython, utils, i18n, dialog) {
"use strict";
var NewNotebookWidget = function (selector, options) {
@ -66,7 +67,7 @@ define([
.attr('href', '#')
.click($.proxy(this.new_notebook, this, ks.name))
.text(ks.spec.display_name)
.attr('title', 'Create a new notebook with ' + ks.spec.display_name)
.attr('title', i18n.sprintf(i18n._('Create a new notebook with %s'), ks.spec.display_name))
);
menu.after(li);
}
@ -90,10 +91,14 @@ define([
w.location = url;
}).catch(function (e) {
w.close();
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [ i18n._("OK")];
dialog.modal({
title : 'Creating Notebook Failed',
title : i18n._('Creating Notebook Failed'),
body : $('<div/>')
.text("An error occurred while creating a new notebook.")
.text(i18n._("An error occurred while creating a new notebook."))
.append($('<div/>')
.addClass('alert alert-danger')
.text(e.message || e)),

@ -5,11 +5,12 @@ define([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/i18n',
'base/js/dialog',
'base/js/events',
'base/js/keyboard',
'moment'
], function($, IPython, utils, dialog, events, keyboard, moment) {
], function($, IPython, utils, i18n, dialog, events, keyboard, moment) {
"use strict";
var extension = function(path){
@ -148,9 +149,9 @@ define([
}).catch(function (e) {
w.close();
dialog.modal({
title: 'Creating File Failed',
title: i18n.msg._('Creating File Failed'),
body: $('<div/>')
.text("An error occurred while creating a new file.")
.text(i18n.msg._("An error occurred while creating a new file."))
.append($('<div/>')
.addClass('alert alert-danger')
.text(e.message || e)),
@ -168,9 +169,9 @@ define([
that.load_list();
}).catch(function (e) {
dialog.modal({
title: 'Creating Folder Failed',
title: i18n.msg._('Creating Folder Failed'),
body: $('<div/>')
.text("An error occurred while creating a new folder.")
.text(i18n.msg._("An error occurred while creating a new folder."))
.append($('<div/>')
.addClass('alert alert-danger')
.text(e.message || e)),
@ -265,8 +266,8 @@ define([
var name = item.data('name');
item.remove();
dialog.modal({
title : 'Failed to read file',
body : "Failed to read file '" + name + "'",
title : i18n.msg._('Failed to read file'),
body : i18n.msg.sprintf(i18n.msg._("Failed to read file %s"),name),
buttons : {'OK' : { 'class' : 'btn-primary' }}
});
};
@ -277,9 +278,11 @@ define([
var file_ext = name_and_ext[1];
if (f.size > this._max_upload_size_mb * 1024 * 1024) {
var body_msg = i18n.msg.sprintf(i18n.msg._("The file size is %d MB. Do you still want to upload it?"),
Math.round(f.size / (1024 * 1024)));
dialog.modal({
title : 'Large file size warning',
body : "The file size is " + Math.round(f.size / (1024 * 1024)) + "MB. Do you still want to upload it?",
title : i18n.msg._('Large file size warning'),
body : body_msg,
buttons : {
Cancel: {},
Ok: {
@ -347,7 +350,7 @@ define([
this.contents.list_contents(that.notebook_path).then(
$.proxy(this.draw_notebook_list, this),
function(error) {
that.draw_notebook_list({content: []}, "Server error: " + error.message);
that.draw_notebook_list({content: []}, i18n.msg._("Server error: ") + error.message);
}
);
};
@ -372,7 +375,7 @@ define([
this.error_msg = error_msg;
list.content.sort(this.sort_function);
var message = error_msg || 'Notebook list empty.';
var message = error_msg || i18n.msg._('The notebook list is empty.');
var item = null;
var model = null;
var len = list.content.length;
@ -440,12 +443,12 @@ define([
var item = $("<div/>")
.addClass("col-md-12")
.appendTo(row);
var checkbox;
if (selectable !== undefined) {
checkbox = $('<input/>')
.attr('type', 'checkbox')
.attr('title', 'Click here to rename, delete, etc.')
.attr('title', i18n.msg._('Click here to rename, delete, etc.'))
.appendTo(item);
}
@ -485,7 +488,7 @@ define([
$('<div/>')
.addClass('running-indicator')
.text('Running')
.text(i18n.msg._('Running'))
.css('visibility', 'hidden')
.appendTo(buttons);
@ -749,7 +752,7 @@ define([
if (model.type !== "directory") {
link.attr('target',IPython._target);
}
// Add in the date that the file was last modified
item.find(".item_modified").text(utils.format_datetime(model.last_modified));
item.find(".item_modified").attr("title", moment(model.last_modified).format("YYYY-MM-DD HH:mm"));
@ -824,14 +827,36 @@ define([
var item_type = this.selected[0].type;
var input = $('<input/>').attr('type','text').attr('size','25').addClass('form-control')
.val(item_name);
var rename_msg = function (type) {
switch(type) {
case 'file': return i18n.msg._("Enter a new file name:");
case 'directory': return i18n.msg._("Enter a new directory name:");
case 'notebook': return i18n.msg._("Enter a new notebook name:");
default: return i18n.msg._("Enter a new name:");
}
}
var rename_title = function (type) {
switch(type) {
case 'file': return i18n.msg._("Rename file");
case 'directory': return i18n.msg._("Rename directory");
case 'notebook': return i18n.msg._("Rename notebook");
default: return i18n.msg._("Rename");
}
}
var dialog_body = $('<div/>').append(
$("<p/>").addClass("rename-message")
.text('Enter a new '+ item_type + ' name:')
.text(rename_msg(item_type))
).append(
$("<br/>")
).append(input);
// This statement is used simply so that message extraction
// will pick up the strings. The actual setting of the text
// for the button is in dialog.js.
var button_labels = [ i18n.msg._("Cancel"), i18n.msg._("Rename"), i18n.msg._("OK"), i18n.msg._("Move")];
var d = dialog.modal({
title : "Rename "+ item_type,
title : rename_title(item_type),
body : dialog_body,
default_button: "Cancel",
buttons : {
@ -844,10 +869,12 @@ define([
// Deselect items after successful rename.
that.select('select-none');
}).catch(function(e) {
var template = i18n.msg._("An error occurred while renaming \"%1$s\" to \"%2$s\".");
var failmsg = i18n.msg.sprintf(template,item_name,input.val());
dialog.modal({
title: "Rename Failed",
title: i18n.msg._("Rename Failed"),
body: $('<div/>')
.text("An error occurred while renaming \"" + item_name + "\" to \"" + input.val() + "\".")
.text(failmsg)
.append($('<div/>')
.addClass('alert alert-danger')
.text(e.message || e)),
@ -894,7 +921,8 @@ define([
.val(utils.url_path_join('/', that.notebook_path));
var dialog_body = $('<div/>').append(
$("<p/>").addClass("rename-message")
.text('Enter new destination directory path for '+ num_items + ' items:')
.text(i18n.msg.sprintf(i18n.msg.ngettext("Enter a new destination directory path for this item:",
"Enter a new destination directory path for these %d items:", num_items),num_items))
).append(
$("<br/>")
).append(
@ -906,7 +934,7 @@ define([
).addClass("move-path")
);
var d = dialog.modal({
title : "Move "+ num_items + " Items",
title : i18n.msg.sprintf(i18n.msg.ngettext("Move an Item","Move %d Items",num_items),num_items),
body : dialog_body,
default_button: "Cancel",
buttons : {
@ -925,10 +953,11 @@ define([
that.load_list();
}).catch(function(e) {
// If any of the moves fails, show this dialog for that move.
var failmsg = i18n.msg._("An error occurred while moving \"%1$s\" from \"%2$s\" to \"%3$s\".");
dialog.modal({
title: "Move Failed",
title: i18n.msg._("Move Failed"),
body: $('<div/>')
.text("An error occurred while moving \"" + item_name + "\" from \"" + item_path + "\" to \"" + new_path + "\".")
.text(i18n.msg.sprintf(failmsg,item_name,item_path,new_path))
.append($('<div/>')
.addClass('alert alert-danger')
.text(e.message || e)),
@ -971,17 +1000,20 @@ define([
};
NotebookList.prototype.delete_selected = function() {
var message;
var selected = this.selected.slice(); // Don't let that.selected change out from under us
var template = i18n.msg.ngettext("Are you sure you want to permanently delete: \"%s\"?",
"Are you sure you want to permanently delete the %d files or folders selected?",
selected.length);
var delete_msg;
if (selected.length === 1) {
message = 'Are you sure you want to permanently delete: ' + selected[0].name + '?';
delete_msg = i18n.msg.sprintf(template, selected[0].name);
} else {
message = 'Are you sure you want to permanently delete the ' + selected.length + ' files/folders selected?';
delete_msg = i18n.msg.sprintf(template, selected.length);
}
var that = this;
dialog.modal({
title : "Delete",
body : message,
title : i18n.msg._("Delete"),
body : delete_msg,
default_button: "Cancel",
buttons : {
Cancel: {},
@ -997,10 +1029,11 @@ define([
that.contents.delete(item.path).then(function() {
that.notebook_deleted(item.path);
}).catch(function(e) {
var failmsg = i18n.msg._("An error occurred while deleting \"%s\".");
dialog.modal({
title: "Delete Failed",
title: i18n.msg._("Delete Failed"),
body: $('<div/>')
.text("An error occurred while deleting \"" + item.path + "\".")
.text(i18n.msg.sprintf(failmsg, item.path))
.append($('<div/>')
.addClass('alert alert-danger')
.text(e.message || e)),
@ -1035,17 +1068,19 @@ define([
};
NotebookList.prototype.duplicate_selected = function() {
var message;
var selected = this.selected.slice(); // Don't let that.selected change out from under us
var template = i18n.msg.ngettext("Are you sure you want to duplicate: \"%s\"?",
"Are you sure you want to duplicate the %d files selected?",selected.length);
var dup_msg;
if (selected.length === 1) {
message = 'Are you sure you want to duplicate: ' + selected[0].name + '?';
dup_msg = i18n.msg.sprintf(template,selected[0].name);
} else {
message = 'Are you sure you want to duplicate the ' + selected.length + ' files selected?';
dup_msg = i18n.msg.sprintf(template,selected.length);
}
var that = this;
dialog.modal({
title : "Duplicate",
body : message,
title : i18n.msg._("Duplicate"),
body : dup_msg,
default_button: "Cancel",
buttons : {
Cancel: {},
@ -1058,10 +1093,11 @@ define([
// Deselect items after successful duplication.
that.select('select-none');
}).catch(function(e) {
var failmsg = i18n.msg._("An error occurred while duplicating \"%s\".");
dialog.modal({
title: "Duplicate Failed",
title: i18n.msg._("Duplicate Failed"),
body: $('<div/>')
.text("An error occurred while duplicating \"" + item.path + "\".")
.text(i18n.msg.sprintf(failmsg,item.path))
.append($('<div/>')
.addClass('alert alert-danger')
.text(e.message || e)),
@ -1278,7 +1314,7 @@ define([
NotebookList.prototype.add_upload_button = function (item) {
var that = this;
var upload_button = $('<button/>').text("Upload")
var upload_button = $('<button/>').text(i18n.msg._("Upload"))
.addClass('btn btn-primary btn-xs upload_button')
.click(function (e) {
var filename = item.find('.item_name > input').val();
@ -1287,8 +1323,8 @@ define([
var format = 'text';
if (filename.length === 0 || filename[0] === '.') {
dialog.modal({
title : 'Invalid file name',
body : "File names must be at least one character and not start with a dot",
title : i18n.msg._('Invalid file name'),
body : i18n.msg._("File names must be at least one character and not start with a period"),
buttons : {'OK' : { 'class' : 'btn-primary' }}
});
return false;
@ -1315,9 +1351,10 @@ define([
try {
model.content = JSON.parse(filedata);
} catch (e) {
var failbody = i18n.msg._("The error was: %s");
dialog.modal({
title : 'Cannot upload invalid Notebook',
body : "The error was: " + e,
title : i18n.msg._('Cannot upload invalid Notebook'),
body : i18n.msg.sprintf(failbody,e),
buttons : {'OK' : {
'class' : 'btn-primary',
click: function () {
@ -1349,9 +1386,10 @@ define([
});
if (exists) {
var body = i18n.msg._("There is already a file named \"%s\". Do you want to replace it?");
dialog.modal({
title : "Replace file",
body : 'There is already a file named ' + filename + ', do you want to replace it?',
title : i18n.msg._("Replace file"),
body : i18n.msg.sprintf(body,filename),
default_button: "Cancel",
buttons : {
Cancel : {
@ -1371,7 +1409,7 @@ define([
return false;
});
var cancel_button = $('<button/>').text("Cancel")
var cancel_button = $('<button/>').text(i18n.msg._("Cancel"))
.addClass("btn btn-default btn-xs")
.click(function (e) {
item.remove();

@ -5,8 +5,9 @@ define([
'jquery',
'base/js/namespace',
'base/js/utils',
'base/js/i18n',
'tree/js/notebooklist',
], function($, IPython, utils, notebooklist) {
], function($, IPython, utils, i18n, notebooklist) {
"use strict";
var TerminalList = function (selector, options) {
@ -101,7 +102,7 @@ define([
TerminalList.prototype.add_shutdown_button = function(name, item) {
var that = this;
var shutdown_button = $("<button/>").text("Shutdown").addClass("btn btn-xs btn-warning").
var shutdown_button = $("<button/>").text(i18n._("Shutdown")).addClass("btn btn-xs btn-warning").
click(function (e) {
var settings = {
processData : false,

@ -1,5 +1,5 @@
{% extends "error.html" %}
{% block error_detail %}
<p>You are requesting a page that does not exist!</p>
<p>{% trans %}You are requesting a page that does not exist!{% endtrans %}</p>
{% endblock %}

@ -34,7 +34,7 @@ data-file-path="{{file_path}}"
<div id="menus" class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<p class="navbar-text indicator_area">
<span id="current-mode" >current mode</span>
<span id="current-mode" >{% trans %}current mode{% endtrans %}</span>
</p>
<button type="button" class="btn btn-default navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<i class="fa fa-bars"></i>
@ -45,34 +45,34 @@ data-file-path="{{file_path}}"
</ul>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}File{% endtrans %}</a>
<ul id="file-menu" class="dropdown-menu">
<li id="new-file"><a href="#">New</a></li>
<li id="save-file"><a href="#">Save</a></li>
<li id="rename-file"><a href="#">Rename</a></li>
<li id="download-file"><a href="#">Download</a></li>
<li id="new-file"><a href="#">{% trans %}New{% endtrans %}</a></li>
<li id="save-file"><a href="#">{% trans %}Save{% endtrans %}</a></li>
<li id="rename-file"><a href="#">{% trans %}Rename{% endtrans %}</a></li>
<li id="download-file"><a href="#">{% trans %}Download{% endtrans %}</a></li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Edit{% endtrans %}</a>
<ul id="edit-menu" class="dropdown-menu">
<li id="menu-find"><a href="#">Find</a></li>
<li id="menu-replace"><a href="#">Find &amp; Replace</a></li>
<li id="menu-find"><a href="#">{% trans %}Find{% endtrans %}</a></li>
<li id="menu-replace"><a href="#">{% trans %}Find &amp; Replace{% endtrans %}</a></li>
<li class="divider"></li>
<li class="dropdown-header">Key Map</li>
<li id="menu-keymap-default"><a href="#">Default<i class="fa"></i></a></li>
<li id="menu-keymap-sublime"><a href="#">Sublime Text<i class="fa"></i></a></li>
<li class="dropdown-header">{% trans %}Key Map{% endtrans %}</li>
<li id="menu-keymap-default"><a href="#">{% trans %}Default{% endtrans %}<i class="fa"></i></a></li>
<li id="menu-keymap-sublime"><a href="#">{% trans %}Sublime Text{% endtrans %}<i class="fa"></i></a></li>
<li id="menu-keymap-vim"><a href="#">Vim<i class="fa"></i></a></li>
<li id="menu-keymap-emacs"><a href="#">emacs<i class="fa"></i></a></li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}View{% endtrans %}</a>
<ul id="view-menu" class="dropdown-menu">
<li id="toggle_header" title="Show/Hide the logo and notebook title (above menu bar)">
<a href="#">Toggle Header</a></li>
<li id="menu-line-numbers"><a href="#">Toggle Line Numbers</a></li>
<li id="toggle_header" title="{% trans %}Show/Hide the logo and notebook title (above menu bar){% endtrans %}">
<a href="#">{% trans %}Toggle Header{% endtrans %}</a></li>
<li id="menu-line-numbers"><a href="#">{% trans %}Toggle Line Numbers{% endtrans %}</a></li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Language</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Language{% endtrans %}</a>
<ul id="mode-menu" class="dropdown-menu">
</ul>
</li>

@ -20,7 +20,7 @@ div#header, div#site {
{% endblock h1_error %}
{% block error_detail %}
{% if message %}
<p>The error was:</p>
<p>{% trans %}The error was:{% endtrans %}</p>
<div class="traceback-wrapper">
<pre class="traceback">{{message}}</pre>
</div>

@ -20,11 +20,15 @@
<div class="navbar-inner">
<div class="container">
<div class="center-nav">
<p class="navbar-text nav">Password{% if token_available %} or token{% endif %}:</p>
{% if token_available %}
<p class="navbar-text nav">{% trans %}Password or token:{% endtrans %}</p>
{% else %}
<p class="navbar-text nav">{% trans %}Password:{% endtrans %}</p>
{% endif %}
<form action="{{base_url}}login?next={{next}}" method="post" class="navbar-form pull-left">
{{ xsrf_form_html() | safe }}
<input type="password" name="password" id="password_input" class="form-control">
<button type="submit" id="login_submit">Log in</button>
<button type="submit" id="login_submit">{% trans %}Log in{% endtrans %}</button>
</form>
</div>
</div>
@ -32,7 +36,7 @@
</div>
</div>
{% else %}
<p>No login available, you shouldn't be seeing this page.</p>
<p>{% trans %}No login available, you shouldn't be seeing this page.{% endtrans %}</p>
{% endif %}
{% if message %}
<div class="row">

@ -21,9 +21,9 @@
{% endif %}
{% if not login_available %}
Proceed to the <a href="{{base_url}}">dashboard</a>.
{% trans %}Proceed to the <a href="{{base_url}}">dashboard{% endtrans %}</a>.
{% else %}
Proceed to the <a href="{{base_url}}login">login page</a>.
{% trans %}Proceed to the <a href="{{base_url}}login">login page{% endtrans %}</a>.
{% endif %}

@ -59,13 +59,13 @@ data-notebook-path="{{notebook_path | urlencode}}"
<div class="container-fluid">
<button type="button" class="btn btn-default navbar-btn navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<i class="fa fa-bars"></i>
<span class="navbar-text">Menu</span>
<span class="navbar-text">{% trans %}Menu{% endtrans %}</span>
</button>
<p id="kernel_indicator" class="navbar-text indicator_area">
<span class="kernel_indicator_name">Kernel</span>
<span class="kernel_indicator_name">{% trans %}Kernel{% endtrans %}</span>
<i id="kernel_indicator_icon"></i>
</p>
<i id="readonly-indicator" class="navbar-text" title='This notebook is read-only'>
<i id="readonly-indicator" class="navbar-text" title='{% trans %}This notebook is read-only{% endtrans %}'>
<span class="fa-stack">
<i class="fa fa-save fa-stack-1x"></i>
<i class="fa fa-ban fa-stack-2x text-danger"></i>
@ -75,25 +75,25 @@ data-notebook-path="{{notebook_path | urlencode}}"
<span id="notification_area"></span>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">File</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}File{% endtrans %}</a>
<ul id="file_menu" class="dropdown-menu">
<li id="new_notebook" class="dropdown-submenu">
<a href="#">New Notebook</a>
<a href="#">{% trans %}New Notebook{% endtrans %}</a>
<ul class="dropdown-menu" id="menu-new-notebook-submenu"></ul>
</li>
<li id="open_notebook"
title="Opens a new window with the Dashboard view">
<a href="#">Open...</a></li>
title="{% trans %}Opens a new window with the Dashboard view{% endtrans %}">
<a href="#">{% trans %}Open...{% endtrans %}</a></li>
<!-- <hr/> -->
<li class="divider"></li>
<li id="copy_notebook"
title="Open a copy of this notebook's contents and start a new kernel">
<a href="#">Make a Copy...</a></li>
<li id="rename_notebook"><a href="#">Rename...</a></li>
<li id="save_checkpoint"><a href="#">Save and Checkpoint</a></li>
title="{% trans %}Open a copy of this notebook's contents and start a new kernel{% endtrans %}">
<a href="#">{% trans %}Make a Copy...{% endtrans %}</a></li>
<li id="rename_notebook"><a href="#">{% trans %}Rename...{% endtrans %}</a></li>
<li id="save_checkpoint"><a href="#">{% trans %}Save and Checkpoint{% endtrans %}</a></li>
<!-- <hr/> -->
<li class="divider"></li>
<li id="restore_checkpoint" class="dropdown-submenu"><a href="#">Revert to Checkpoint</a>
<li id="restore_checkpoint" class="dropdown-submenu"><a href="#">{% trans %}Revert to Checkpoint{% endtrans %}</a>
<ul class="dropdown-menu">
<li><a href="#"></a></li>
<li><a href="#"></a></li>
@ -103,175 +103,175 @@ data-notebook-path="{{notebook_path | urlencode}}"
</ul>
</li>
<li class="divider"></li>
<li id="print_preview"><a href="#">Print Preview</a></li>
<li class="dropdown-submenu"><a href="#">Download as</a>
<li id="print_preview"><a href="#">{% trans %}Print Preview{% endtrans %}</a></li>
<li class="dropdown-submenu"><a href="#">{% trans %}Download as{% endtrans %}</a>
<ul id="download_menu" class="dropdown-menu">
<li id="download_ipynb"><a href="#">Notebook (.ipynb)</a></li>
<li id="download_script"><a href="#">Script</a></li>
<li id="download_html"><a href="#">HTML (.html)</a></li>
<li id="download_markdown"><a href="#">Markdown (.md)</a></li>
<li id="download_rst"><a href="#">reST (.rst)</a></li>
<li id="download_latex"><a href="#">LaTeX (.tex)</a></li>
<li id="download_pdf"><a href="#">PDF via LaTeX (.pdf)</a></li>
<li id="download_ipynb"><a href="#">{% trans %}Notebook (.ipynb){% endtrans %}</a></li>
<li id="download_script"><a href="#">{% trans %}Script{% endtrans %}</a></li>
<li id="download_html"><a href="#">{% trans %}HTML (.html){% endtrans %}</a></li>
<li id="download_markdown"><a href="#">{% trans %}Markdown (.md){% endtrans %}</a></li>
<li id="download_rst"><a href="#">{% trans %}reST (.rst){% endtrans %}</a></li>
<li id="download_latex"><a href="#">{% trans %}LaTeX (.tex){% endtrans %}</a></li>
<li id="download_pdf"><a href="#">{% trans %}PDF via LaTeX (.pdf){% endtrans %}</a></li>
</ul>
</li>
<li class="dropdown-submenu hidden"><a href="#">Deploy as</a>
<li class="dropdown-submenu hidden"><a href="#">{% trans %}Deploy as{% endtrans %}</a>
<ul id="deploy_menu" class="dropdown-menu"></ul>
</li>
<li class="divider"></li>
<li id="trust_notebook"
title="Trust the output of this notebook">
<a href="#" >Trust Notebook</a></li>
title="{% trans %}Trust the output of this notebook{% endtrans %}">
<a href="#" >{% trans %}Trust Notebook{% endtrans %}</a></li>
<li class="divider"></li>
<li id="kill_and_exit"
title="Shutdown this notebook's kernel, and close this window">
<a href="#" >Close and Halt</a></li>
title="{% trans %}Shutdown this notebook's kernel, and close this window{% endtrans %}">
<a href="#" >{% trans %}Close and Halt{% endtrans %}</a></li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Edit</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Edit{% endtrans %}</a>
<ul id="edit_menu" class="dropdown-menu">
<li id="cut_cell"><a href="#">Cut Cells</a></li>
<li id="copy_cell"><a href="#">Copy Cells</a></li>
<li id="paste_cell_above" class="disabled"><a href="#">Paste Cells Above</a></li>
<li id="paste_cell_below" class="disabled"><a href="#">Paste Cells Below</a></li>
<li id="paste_cell_replace" class="disabled"><a href="#">Paste Cells &amp; Replace</a></li>
<li id="delete_cell"><a href="#">Delete Cells</a></li>
<li id="undelete_cell" class="disabled"><a href="#">Undo Delete Cells</a></li>
<li id="cut_cell"><a href="#">{% trans %}Cut Cells{% endtrans %}</a></li>
<li id="copy_cell"><a href="#">{% trans %}Copy Cells{% endtrans %}</a></li>
<li id="paste_cell_above" class="disabled"><a href="#">{% trans %}Paste Cells Above{% endtrans %}</a></li>
<li id="paste_cell_below" class="disabled"><a href="#">{% trans %}Paste Cells Below{% endtrans %}</a></li>
<li id="paste_cell_replace" class="disabled"><a href="#">{% trans %}Paste Cells &amp; Replace{% endtrans %}</a></li>
<li id="delete_cell"><a href="#">{% trans %}Delete Cells{% endtrans %}</a></li>
<li id="undelete_cell" class="disabled"><a href="#">{% trans %}Undo Delete Cells{% endtrans %}</a></li>
<li class="divider"></li>
<li id="split_cell"><a href="#">Split Cell</a></li>
<li id="merge_cell_above"><a href="#">Merge Cell Above</a></li>
<li id="merge_cell_below"><a href="#">Merge Cell Below</a></li>
<li id="split_cell"><a href="#">{% trans %}Split Cell{% endtrans %}</a></li>
<li id="merge_cell_above"><a href="#">{% trans %}Merge Cell Above{% endtrans %}</a></li>
<li id="merge_cell_below"><a href="#">{% trans %}Merge Cell Below{% endtrans %}</a></li>
<li class="divider"></li>
<li id="move_cell_up"><a href="#">Move Cell Up</a></li>
<li id="move_cell_down"><a href="#">Move Cell Down</a></li>
<li id="move_cell_up"><a href="#">{% trans %}Move Cell Up{% endtrans %}</a></li>
<li id="move_cell_down"><a href="#">{% trans %}Move Cell Down{% endtrans %}</a></li>
<li class="divider"></li>
<li id="edit_nb_metadata"><a href="#">Edit Notebook Metadata</a></li>
<li id="edit_nb_metadata"><a href="#">{% trans %}Edit Notebook Metadata{% endtrans %}</a></li>
<li class="divider"></li>
<li id="find_and_replace"><a href="#"> Find and Replace </a></li>
<li id="find_and_replace"><a href="#"> {% trans %}Find and Replace{% endtrans %} </a></li>
<li class="divider"></li>
<li id="cut_cell_attachments"><a href="#">Cut Cell Attachments</a></li>
<li id="copy_cell_attachments"><a href="#">Copy Cell Attachments</a></li>
<li id="paste_cell_attachments" class="disabled"><a href="#">Paste Cell Attachments</a></li>
<li id="cut_cell_attachments"><a href="#">{% trans %}Cut Cell Attachments{% endtrans %}</a></li>
<li id="copy_cell_attachments"><a href="#">{% trans %}Copy Cell Attachments{% endtrans %}</a></li>
<li id="paste_cell_attachments" class="disabled"><a href="#">{% trans %}Paste Cell Attachments{% endtrans %}</a></li>
<li class="divider"></li>
<li id="insert_image" class="disabled"><a href="#"> Insert Image </a></li>
<li id="insert_image" class="disabled"><a href="#"> {% trans %}Insert Image{% endtrans %} </a></li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">View</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}View{% endtrans %}</a>
<ul id="view_menu" class="dropdown-menu">
<li id="toggle_header"
title="Show/Hide the logo and notebook title (above menu bar)">
<a href="#">Toggle Header</a>
title="{% trans %}Show/Hide the logo and notebook title (above menu bar){% endtrans %}">
<a href="#">{% trans %}Toggle Header{% endtrans %}</a>
</li>
<li id="toggle_toolbar"
title="Show/Hide the action icons (below menu bar)">
<a href="#">Toggle Toolbar</a>
title="{% trans %}Show/Hide the action icons (below menu bar){% endtrans %}">
<a href="#">{% trans %}Toggle Toolbar{% endtrans %}</a>
</li>
<li id="toggle_line_numbers"
title="Show/Hide line numbers in cells">
<a href="#">Toggle Line Numbers</a>
title="{% trans %}Show/Hide line numbers in cells{% endtrans %}">
<a href="#">{% trans %}Toggle Line Numbers{% endtrans %}</a>
</li>
<li id="menu-cell-toolbar" class="dropdown-submenu">
<a href="#">Cell Toolbar</a>
<a href="#">{% trans %}Cell Toolbar{% endtrans %}</a>
<ul class="dropdown-menu" id="menu-cell-toolbar-submenu"></ul>
</li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Insert</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Insert{% endtrans %}</a>
<ul id="insert_menu" class="dropdown-menu">
<li id="insert_cell_above"
title="Insert an empty Code cell above the currently active cell">
<a href="#">Insert Cell Above</a></li>
title="{% trans %}Insert an empty Code cell above the currently active cell{% endtrans %}">
<a href="#">{% trans %}Insert Cell Above{% endtrans %}</a></li>
<li id="insert_cell_below"
title="Insert an empty Code cell below the currently active cell">
<a href="#">Insert Cell Below</a></li>
title="{% trans %}Insert an empty Code cell below the currently active cell{% endtrans %}">
<a href="#">{% trans %}Insert Cell Below{% endtrans %}</a></li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Cell</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Cell{% endtrans %}</a>
<ul id="cell_menu" class="dropdown-menu">
<li id="run_cell" title="Run this cell, and move cursor to the next one">
<a href="#">Run Cells</a></li>
<li id="run_cell_select_below" title="Run this cell, select below">
<a href="#">Run Cells and Select Below</a></li>
<li id="run_cell_insert_below" title="Run this cell, insert below">
<a href="#">Run Cells and Insert Below</a></li>
<li id="run_all_cells" title="Run all cells in the notebook">
<a href="#">Run All</a></li>
<li id="run_all_cells_above" title="Run all cells above (but not including) this cell">
<a href="#">Run All Above</a></li>
<li id="run_all_cells_below" title="Run this cell and all cells below it">
<a href="#">Run All Below</a></li>
<li id="run_cell" title="{% trans %}Run this cell, and move cursor to the next one{% endtrans %}">
<a href="#">{% trans %}Run Cells{% endtrans %}</a></li>
<li id="run_cell_select_below" title="{% trans %}Run this cell, select below{% endtrans %}">
<a href="#">{% trans %}Run Cells and Select Below{% endtrans %}</a></li>
<li id="run_cell_insert_below" title="{% trans %}Run this cell, insert below{% endtrans %}">
<a href="#">{% trans %}Run Cells and Insert Below{% endtrans %}</a></li>
<li id="run_all_cells" title="{% trans %}Run all cells in the notebook{% endtrans %}">
<a href="#">{% trans %}Run All{% endtrans %}</a></li>
<li id="run_all_cells_above" title="{% trans %}Run all cells above (but not including) this cell{% endtrans %}">
<a href="#">{% trans %}Run All Above{% endtrans %}</a></li>
<li id="run_all_cells_below" title="{% trans %}Run this cell and all cells below it{% endtrans %}">
<a href="#">{% trans %}Run All Below{% endtrans %}</a></li>
<li class="divider"></li>
<li id="change_cell_type" class="dropdown-submenu"
title="All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells">
<a href="#">Cell Type</a>
title="{% trans %}All cells in the notebook have a cell type. By default, new cells are created as 'Code' cells{% endtrans %}">
<a href="#">{% trans %}Cell Type{% endtrans %}</a>
<ul class="dropdown-menu">
<li id="to_code"
title="Contents will be sent to the kernel for execution, and output will display in the footer of cell">
title="{% trans %}Contents will be sent to the kernel for execution, and output will display in the footer of cell{% endtrans %}">
<a href="#">Code</a></li>
<li id="to_markdown"
title="Contents will be rendered as HTML and serve as explanatory text">
<a href="#">Markdown</a></li>
title="{% trans %}Contents will be rendered as HTML and serve as explanatory text{% endtrans %}">
<a href="#">{% trans %}Markdown{% endtrans %}</a></li>
<li id="to_raw"
title="Contents will pass through nbconvert unmodified">
<a href="#">Raw NBConvert</a></li>
title="{% trans %}Contents will pass through nbconvert unmodified{% endtrans %}">
<a href="#">{% trans %}Raw NBConvert{% endtrans %}</a></li>
</ul>
</li>
<li class="divider"></li>
<li id="current_outputs" class="dropdown-submenu"><a href="#">Current Outputs</a>
<li id="current_outputs" class="dropdown-submenu"><a href="#">{% trans %}Current Outputs{% endtrans %}</a>
<ul class="dropdown-menu">
<li id="toggle_current_output"
title="Hide/Show the output of the current cell">
<a href="#">Toggle</a>
title="{% trans %}Hide/Show the output of the current cell{% endtrans %}">
<a href="#">{% trans %}Toggle{% endtrans %}</a>
</li>
<li id="toggle_current_output_scroll"
title="Scroll the output of the current cell">
<a href="#">Toggle Scrolling</a>
title="{% trans %}Scroll the output of the current cell{% endtrans %}">
<a href="#">{% trans %}Toggle Scrolling{% endtrans %}</a>
</li>
<li id="clear_current_output"
title="Clear the output of the current cell">
<a href="#">Clear</a>
title="{% trans %}Clear the output of the current cell{% endtrans %}">
<a href="#">{% trans %}Clear{% endtrans %}</a>
</li>
</ul>
</li>
<li id="all_outputs" class="dropdown-submenu"><a href="#">All Output</a>
<li id="all_outputs" class="dropdown-submenu"><a href="#">{% trans %}All Output{% endtrans %}</a>
<ul class="dropdown-menu">
<li id="toggle_all_output"
title="Hide/Show the output of all cells">
<a href="#">Toggle</a>
title="{% trans %}Hide/Show the output of all cells{% endtrans %}">
<a href="#">{% trans %}Toggle{% endtrans %}</a>
</li>
<li id="toggle_all_output_scroll"
title="Scroll the output of all cells">
<a href="#">Toggle Scrolling</a>
title="{% trans %}Scroll the output of all cells{% endtrans %}">
<a href="#">{% trans %}Toggle Scrolling{% endtrans %}</a>
</li>
<li id="clear_all_output"
title="Clear the output of all cells">
<a href="#">Clear</a>
title="{% trans %}Clear the output of all cells{% endtrans %}">
<a href="#">{% trans %}Clear{% endtrans %}</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Kernel</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Kernel{% endtrans %}</a>
<ul id="kernel_menu" class="dropdown-menu">
<li id="int_kernel"
title="Send KeyboardInterrupt (CTRL-C) to the Kernel">
<a href="#">Interrupt</a>
title="{% trans %}Send Keyboard Interrupt (CTRL-C) to the Kernel{% endtrans %}">
<a href="#">{% trans %}Interrupt{% endtrans %}</a>
</li>
<li id="restart_kernel"
title="Restart the Kernel">
<a href="#">Restart</a>
title="{% trans %}Restart the Kernel{% endtrans %}">
<a href="#">{% trans %}Restart{% endtrans %}</a>
</li>
<li id="restart_clear_output"
title="Restart the Kernel and clear all output">
<a href="#">Restart &amp; Clear Output</a>
title="{% trans %}Restart the Kernel and clear all output{% endtrans %}">
<a href="#">{% trans %}Restart &amp; Clear Output{% endtrans %}</a>
</li>
<li id="restart_run_all"
title="Restart the Kernel and re-run the notebook">
<a href="#">Restart &amp; Run All</a>
title="{% trans %}Restart the Kernel and re-run the notebook{% endtrans %}">
<a href="#">{% trans %}Restart &amp; Run All{% endtrans %}</a>
</li>
<li id="reconnect_kernel"
title="Reconnect to the Kernel">
<a href="#">Reconnect</a>
title="{% trans %}Reconnect to the Kernel{% endtrans %}">
<a href="#">{% trans %}Reconnect{% endtrans %}</a>
</li>
<li id="shutdown_kernel"
title="Shutdown the Kernel">
@ -279,30 +279,31 @@ data-notebook-path="{{notebook_path | urlencode}}"
</li>
<li class="divider"></li>
<li id="menu-change-kernel" class="dropdown-submenu">
<a href="#">Change kernel</a>
<a href="#">{% trans %}Change kernel{% endtrans %}</a>
<ul class="dropdown-menu" id="menu-change-kernel-submenu"></ul>
</li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Help</a>
<li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans %}Help{% endtrans %}</a>
<ul id="help_menu" class="dropdown-menu">
{% block help %}
<li id="notebook_tour" title="A quick tour of the notebook user interface"><a href="#">User Interface Tour</a></li>
<li id="keyboard_shortcuts" title="Opens a dialog which shows all keyboard shortcuts"><a href="#">Keyboard Shortcuts</a></li>
<li id="edit_keyboard_shortcuts" title="Opens a dialog allowing you to edit Keyboard shortcuts"><a href="#">Edit Keyboard Shortcuts</a></li>
<li id="notebook_tour" title="{% trans %}A quick tour of the notebook user interface{% endtrans %}"><a href="#">{% trans %}User Interface Tour{% endtrans %}</a></li>
<li id="keyboard_shortcuts" title="{% trans %}Opens a tooltip with all keyboard shortcuts{% endtrans %}"><a href="#">{% trans %}Keyboard Shortcuts{% endtrans %}</a></li>
<li id="edit_keyboard_shortcuts" title="{% trans %}Opens a dialog allowing you to edit Keyboard shortcuts{% endtrans %}"><a href="#">{% trans %}Edit Keyboard Shortcuts{% endtrans %}</a></li>
<li class="divider"></li>
{% set
sections = (
(
("http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", "Notebook Help", True),
("https://help.github.com/articles/markdown-basics/","Markdown",True),
("http://nbviewer.ipython.org/github/ipython/ipython/blob/3.x/examples/Notebook/Index.ipynb", _("Notebook Help"), True),
("https://help.github.com/articles/markdown-basics/",_("Markdown"),True),
),
)
%}
{% set openmsg = _("Opens in a new window") %}
{% for helplinks in sections %}
{% for link in helplinks %}
<li><a rel="noreferrer" href="{{link[0]}}" target="{{'_blank' if link[2]}}" title="{{'Opens in a new window' if link[2]}}">
<li><a rel="noreferrer" href="{{link[0]}}" target="{{'_blank' if link[2]}}" title="{{openmsg if link[2]}}">
{% if link[2] %}
<i class="fa fa-external-link menu-icon pull-right"></i>
{% endif %}
@ -315,7 +316,7 @@ data-notebook-path="{{notebook_path | urlencode}}"
{% endif %}
{% endfor %}
<li class="divider"></li>
<li title="About Jupyter Notebook"><a id="notebook_about" href="#">About</a></li>
<li title="{% trans %}About Jupyter Notebook{% endtrans %}"><a id="notebook_about" href="#">{% trans %}About{% endtrans %}</a></li>
{% endblock %}
</ul>
</li>

@ -111,14 +111,14 @@ dir="ltr">
<noscript>
<div id='noscript'>
Jupyter Notebook requires JavaScript.<br>
Please enable it to proceed.
{% trans %}Jupyter Notebook requires JavaScript.{% endtrans %}<br>
{% trans %}Please enable it to proceed. {% endtrans %}
</div>
</noscript>
<div id="header">
<div id="header-container" class="container">
<div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{default_url}}" title='dashboard'>{% block logo %}<img src='{{static_url("base/images/logo.png") }}' alt='Jupyter Notebook'/>{% endblock %}</a></div>
<div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{default_url}}" title='{% trans %}dashboard{% endtrans %}'>{% block logo %}<img src='{{static_url("base/images/logo.png") }}' alt='Jupyter Notebook'/>{% endblock %}</a></div>
{% block headercontainer %}
{% endblock %}
@ -129,9 +129,9 @@ dir="ltr">
<span id="login_widget">
{% if logged_in %}
<button id="logout" class="btn btn-sm navbar-btn">Logout</button>
<button id="logout" class="btn btn-sm navbar-btn">{% trans %}Logout{% endtrans %}</button>
{% elif login_available and not logged_in %}
<button id="login" class="btn btn-sm navbar-btn">Login</button>
<button id="login" class="btn btn-sm navbar-btn">{% trans %}Login{% endtrans %}</button>
{% endif %}
</span>

@ -20,26 +20,26 @@ data-server-root="{{server_root}}"
<div id="ipython-main-app" class="container">
<div id="tab_content" class="tabbable">
<ul id="tabs" class="nav nav-tabs">
<li class="active"><a href="#notebooks" data-toggle="tab">Files</a></li>
<li><a href="#running" data-toggle="tab">Running</a></li>
<li><a href="#clusters" data-toggle="tab" class="clusters_tab_link" >Clusters</a></li>
<li class="active"><a href="#notebooks" data-toggle="tab">{% trans %}Files{% endtrans %}</a></li>
<li><a href="#running" data-toggle="tab">{% trans %}Running{% endtrans %}</a></li>
<li><a href="#clusters" data-toggle="tab" class="clusters_tab_link" >{% trans %}Clusters{% endtrans %}</a></li>
</ul>
<div class="tab-content">
<div id="notebooks" class="tab-pane active">
<div id="notebook_toolbar" class="row">
<div class="col-sm-8 no-padding">
<div class="dynamic-instructions">
Select items to perform actions on them.
{% trans %}Select items to perform actions on them.{% endtrans %}
</div>
<div class="dynamic-buttons">
<button title="Duplicate selected" class="duplicate-button btn btn-default btn-xs">Duplicate</button>
<button title="Rename selected" class="rename-button btn btn-default btn-xs">Rename</button>
<button title="Move selected" class="move-button btn btn-default btn-xs">Move</button>
<button title="Download selected" class="download-button btn btn-default btn-xs">Download</button>
<button title="Shutdown selected notebook(s)" class="shutdown-button btn btn-default btn-xs btn-warning">Shutdown</button>
<button title="View selected" class="view-button btn btn-default btn-xs">View</button>
<button title="Edit selected" class="edit-button btn btn-default btn-xs">Edit</button>
<button title="Delete selected" class="delete-button btn btn-default btn-xs btn-danger"><i class="fa fa-trash"></i></button>
<button title="{% trans %}Duplicate selected{% endtrans %}" class="duplicate-button btn btn-default btn-xs">{% trans %}Duplicate{% endtrans %}</button>
<button title="{% trans %}Rename selected{% endtrans %}" class="rename-button btn btn-default btn-xs">{% trans %}Rename{% endtrans %}</button>
<button title="{% trans %}Move selected{% endtrans %}" class="move-button btn btn-default btn-xs">{% trans %}Move{% endtrans %}</button>
<button title="{% trans %}Download selected{% endtrans %}" class="download-button btn btn-default btn-xs">{% trans %}Download{% endtrans %}</button>
<button title="{% trans %}Shutdown selected notebook(s){% endtrans %}" class="shutdown-button btn btn-default btn-xs btn-warning">{% trans %}Shutdown{% endtrans %}</button>
<button title="{% trans %}View selected{% endtrans %}" class="view-button btn btn-default btn-xs">{% trans %}View{% endtrans %}</button>
<button title="{% trans %}Edit selected{% endtrans %}" class="edit-button btn btn-default btn-xs">{% trans %}Edit{% endtrans %}</button>
<button title="{% trans %}Delete selected{% endtrans %}" class="delete-button btn btn-default btn-xs btn-danger"><i class="fa fa-trash"></i></button>
</div>
</div>
<div class="col-sm-4 no-padding tree-buttons">
@ -47,14 +47,14 @@ data-server-root="{{server_root}}"
<form id='alternate_upload' class='alternate_upload'>
<span id="notebook_list_info">
<span class="btn btn-xs btn-default btn-upload">
<input title="Click to browse for a file to upload." type="file" name="datafile" class="fileinput" multiple='multiple'>
Upload
<input title="{% trans %}Click to browse for a file to upload.{% endtrans %}" type="file" name="datafile" class="fileinput" multiple='multiple'>
{% trans %}Upload{% endtrans %}
</span>
</span>
</form>
<div id="new-buttons" class="btn-group">
<button class="dropdown-toggle btn btn-default btn-xs" data-toggle="dropdown">
<span>New</span>
<span>{% trans %}New{% endtrans %}</span>
<span class="caret"></span>
</button>
<ul id="new-menu" class="dropdown-menu">
@ -62,24 +62,24 @@ data-server-root="{{server_root}}"
<li role="presentation" class="divider"></li>
<li role="presentation" class="dropdown-header" >Other:</li>
<li role="presentation" id="new-file">
<a role="menuitem" tabindex="-1" href="#">Text File</a>
<a role="menuitem" tabindex="-1" href="#">{% trans %}Text File{% endtrans %}</a>
</li>
<li role="presentation" id="new-folder">
<a role="menuitem" tabindex="-1" href="#">Folder</a>
<a role="menuitem" tabindex="-1" href="#">{% trans %}Folder{% endtrans %}</a>
</li>
{% if terminals_available %}
<li role="presentation" id="new-terminal">
<a role="menuitem" tabindex="-1" href="#">Terminal</a>
<a role="menuitem" tabindex="-1" href="#">{% trans %}Terminal{% endtrans %}</a>
</li>
{% else %}
<li role="presentation" id="new-terminal-disabled" class="disabled">
<a role="menuitem" tabindex="-1" href="#">Terminals Unavailable</a>
<a role="menuitem" tabindex="-1" href="#">{% trans %}Terminals Unavailable{% endtrans %}</a>
</li>
{% endif %}
</ul>
</div>
<div class="btn-group">
<button id="refresh_notebook_list" title="Refresh notebook list" class="btn btn-default btn-xs"><i class="fa fa-refresh"></i></button>
<button id="refresh_notebook_list" title="{% trans %}Refresh notebook list{% endtrans %}" class="btn btn-default btn-xs"><i class="fa fa-refresh"></i></button>
</div>
</div>
</div>
@ -87,18 +87,18 @@ data-server-root="{{server_root}}"
<div id="notebook_list">
<div id="notebook_list_header" class="row list_header">
<div class="btn-group dropdown" id="tree-selector">
<button title="Select All / None" type="button" class="btn btn-default btn-xs" id="button-select-all">
<button title="{% trans %}Select All / None{% endtrans %}" type="button" class="btn btn-default btn-xs" id="button-select-all">
<input type="checkbox" class="pull-left tree-selector" id="select-all"><span id="counter-select-all">&nbsp;</span></input>
</button>
<button title="Select..." class="btn btn-default btn-xs dropdown-toggle" type="button" id="tree-selector-btn" data-toggle="dropdown" aria-expanded="true">
<button title="{% trans %}Select...{% endtrans %}" class="btn btn-default btn-xs dropdown-toggle" type="button" id="tree-selector-btn" data-toggle="dropdown" aria-expanded="true">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul id='selector-menu' class="dropdown-menu" role="menu" aria-labelledby="tree-selector-btn">
<li role="presentation"><a id="select-folders" role="menuitem" tabindex="-1" href="#" title="Select All Folders"><i class="menu_icon folder_icon icon-fixed-width"></i> Folders</a></li>
<li role="presentation"><a id="select-notebooks" role="menuitem" tabindex="-1" href="#" title="Select All Notebooks"><i class="menu_icon notebook_icon icon-fixed-width"></i> All Notebooks</a></li>
<li role="presentation"><a id="select-running-notebooks" role="menuitem" tabindex="-1" href="#" title="Select Running Notebooks"><i class="menu_icon running_notebook_icon icon-fixed-width"></i> Running</a></li>
<li role="presentation"><a id="select-files" role="menuitem" tabindex="-1" href="#" title="Select All Files"><i class="menu_icon file_icon icon-fixed-width"></i> Files</a></li>
<li role="presentation"><a id="select-folders" role="menuitem" tabindex="-1" href="#" title="{% trans %}Select All Folders{% endtrans %}"><i class="menu_icon folder_icon icon-fixed-width"></i>{% trans %} Folders{% endtrans %}</a></li>
<li role="presentation"><a id="select-notebooks" role="menuitem" tabindex="-1" href="#" title="{% trans %}Select All Notebooks{% endtrans %}"><i class="menu_icon notebook_icon icon-fixed-width"></i>{% trans %} All Notebooks{% endtrans %}</a></li>
<li role="presentation"><a id="select-running-notebooks" role="menuitem" tabindex="-1" href="#" title="{% trans %}Select Running Notebooks{% endtrans %}"><i class="menu_icon running_notebook_icon icon-fixed-width"></i>{% trans %} Running{% endtrans %}</a></li>
<li role="presentation"><a id="select-files" role="menuitem" tabindex="-1" href="#" title="{% trans %}Select All Files{% endtrans %}"><i class="menu_icon file_icon icon-fixed-width"></i>{% trans %} Files{% endtrans %}</a></li>
</ul>
</div>
<div id="project_name">
@ -111,13 +111,13 @@ data-server-root="{{server_root}}"
</div>
<div id="last_modified" class="pull-right sort_button">
<span class="btn btn-xs btn-default sort-action" id="last-modified">
Last Modified
{% trans %}Last Modified{% endtrans %}
<i class="fa"></i>
</span>
</div>
<div id="sort_name" class="pull-right sort_button">
<span class="btn btn-xs btn-default sort-action" id="sort-name">
Name
{% trans %}Name{% endtrans %}
<i class="fa fa-arrow-down"></i>
</span>
</div>
@ -127,11 +127,11 @@ data-server-root="{{server_root}}"
<div id="running" class="tab-pane">
<div id="running_toolbar" class="row">
<div class="col-sm-8 no-padding">
<span id="running_list_info">Currently running Jupyter processes</span>
<span id="running_list_info">{% trans %}Currently running Jupyter processes{% endtrans %}</span>
</div>
<div class="col-sm-4 no-padding tree-buttons">
<span id="running_buttons" class="pull-right">
<button id="refresh_running_list" title="Refresh running list" class="btn btn-default btn-xs"><i class="fa fa-refresh"></i></button>
<button id="refresh_running_list" title="{% trans %}Refresh running list{% endtrans %}" class="btn btn-default btn-xs"><i class="fa fa-refresh"></i></button>
</span>
</div>
</div>
@ -147,9 +147,9 @@ data-server-root="{{server_root}}"
<div id="terminal_list">
<div id="terminal_list_header" class="row list_placeholder">
{% if terminals_available %}
<div> There are no terminals running. </div>
<div> {% trans %}There are no terminals running.{% endtrans %} </div>
{% else %}
<div> Terminals are unavailable. </div>
<div> {% trans %}Terminals are unavailable.{% endtrans %} </div>
{% endif %}
</div>
</div>
@ -159,14 +159,14 @@ data-server-root="{{server_root}}"
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" data-target="#collapseTwo" href="#">
Notebooks
{% trans %}Notebooks{% endtrans %}
</a>
</div>
<div id="collapseTwo" class=" collapse in">
<div class="panel-body">
<div id="running_list">
<div id="running_list_placeholder" class="row list_placeholder">
<div> There are no notebooks running. </div>
<div> {% trans %}There are no notebooks running.{% endtrans %} </div>
</div>
</div>
</div>
@ -175,8 +175,8 @@ data-server-root="{{server_root}}"
</div>
</div>
<div id="clusters" class="tab-pane">
Clusters tab is now provided by IPython parallel.
See <a href="https://github.com/ipython/ipyparallel">IPython parallel</a> for installation details.
{% trans %}Clusters tab is now provided by IPython parallel.{% endtrans %}
{% trans %}See '<a href="https://github.com/ipython/ipyparallel">IPython parallel</a>' for installation details.{% endtrans %}
</div>
</div><!-- class:tab-content -->
</div><!-- id:tab_content -->

@ -140,6 +140,7 @@ def find_package_data():
pjoin(components, "es6-promise", "*.js"),
pjoin(components, "font-awesome", "fonts", "*.*"),
pjoin(components, "google-caja", "html-css-sanitizer-minified.js"),
pjoin(components, "jed", "jed.js"),
pjoin(components, "jquery", "jquery.min.js"),
pjoin(components, "jquery-typeahead", "dist", "jquery.typeahead.min.js"),
pjoin(components, "jquery-typeahead", "dist", "jquery.typeahead.min.css"),
@ -151,9 +152,11 @@ def find_package_data():
pjoin(components, "preact-compat", "index.js"),
pjoin(components, "proptypes", "index.js"),
pjoin(components, "requirejs", "require.js"),
pjoin(components, "requirejs-plugins", "src", "json.js"),
pjoin(components, "requirejs-text", "text.js"),
pjoin(components, "underscore", "underscore-min.js"),
pjoin(components, "moment", "moment.js"),
pjoin(components, "moment", "min", "moment.min.js"),
pjoin(components, "moment", "min", "*.js"),
pjoin(components, "xterm.js", "dist", "xterm.js"),
pjoin(components, "xterm.js", "dist", "xterm.css"),
pjoin(components, "text-encoding", "lib", "encoding.js"),

@ -15,11 +15,14 @@ var rjs_config = {
paths: {
underscore : 'components/underscore/underscore-min',
backbone : 'components/backbone/backbone-min',
jed: 'components/jed/jed',
jquery: 'components/jquery/jquery.min',
json: 'components/requirejs-plugins/src/json',
text: 'components/requirejs-text/text',
bootstrap: 'components/bootstrap/js/bootstrap.min',
bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
"jquery-ui": 'components/jquery-ui/ui/minified/jquery-ui.min',
moment: 'components/moment/moment',
moment: 'components/moment/min/moment-with-locales',
codemirror: 'components/codemirror',
xterm: 'components/xterm.js/dist/xterm',
typeahead: 'components/jquery-typeahead/dist/jquery.typeahead',

Loading…
Cancel
Save