Browse Source

[docs] [translate] fixes

version-14
Rushabh Mehta 12 years ago
parent
commit
77eef0ecf5
9 changed files with 46 additions and 57 deletions
  1. +13
    -11
      core/doctype/documentation_tool/docs.html
  2. +9
    -7
      core/doctype/documentation_tool/documentation_tool.js
  3. +4
    -1
      core/doctype/documentation_tool/documentation_tool.py
  4. +1
    -1
      docs/docs.dev.framework.md
  5. +1
    -1
      public/js/wn/ui/toolbar/bookmarks.js
  6. +1
    -1
      public/js/wn/ui/toolbar/recent.js
  7. +1
    -1
      public/js/wn/ui/toolbar/toolbar.js
  8. +10
    -11
      webnotes/__init__.py
  9. +6
    -23
      webnotes/translate.py

+ 13
- 11
core/doctype/documentation_tool/docs.html View File

@@ -16,7 +16,7 @@
</head>
<body>
<header>
<div class="navbar navbar-fixed-top">
<div class="navbar">
<div class="container">
<button type="button" class="navbar-toggle"
data-toggle="collapse" data-target=".navbar-responsive-collapse">
@@ -26,7 +26,7 @@
</button>
<a class="navbar-brand" href="index.html">
<object data="img/splash.svg" class="erpnext-logo"
type="image/svg+xml"></object> erpnext</a>
type="image/svg+xml"></object> erpnext.org</a>
<div class="nav-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav">
<li><a href="docs.user.html">User</a></li>
@@ -42,7 +42,7 @@
</div>
</div>
</header>
<div class="container" style=" margin-top: 70px;">
<div class="container" style=" margin-top: 30px;">
<!-- div class="logo" style="margin-bottom: 15px; height: 71px;">
<a href="docs.html">
<img src="img/erpnext-2013.png" style="width: 71px; margin-top: -10px;" />
@@ -60,14 +60,16 @@
<div class="footer text-muted" style="font-size: 80%;">
<div class="content row">
<div class="col col-lg-12">
&copy; <a href="https://erpnext.com">Web Notes Technologies Pvt Ltd.</a><br>
ERPNext is an <a href="https://github.com/webnotes/erpnext" target="_blank">
open source project</a>. Code licensed under the
<a href="https://www.gnu.org/licenses/gpl.html">GNU/GPL License</a>.
Documentation Licensed under <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA-3.0</a>.<br>
<a href="docs.user.help.html">Get Help</a> /
<a href="https://erpnext.com">Buy Hosting or Support Services</a><br>
<a href="https://erpnext.com/donate">Donate to help make this product better</a>
&copy; <a href="https://erpnext.com">Web Notes</a> |
<a href="docs.user.help.html">Help</a> |
<a href="https://github.com/webnotes/erpnext" target="_blank">Code</a> |
<a href="https://erpnext.com">Buy Hosting</a> |
<a href="https://erpnext.com/donate">Donate</a>
<br>
<p>
Code License: <a href="https://www.gnu.org/licenses/gpl.html">GNU/GPL 3</a>.
Documentation License: <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA-3.0</a>.
</p>
</div>
</div>
</div>


+ 9
- 7
core/doctype/documentation_tool/documentation_tool.js View File

@@ -216,18 +216,20 @@ wn.docs.DocsPage = Class.extend({
}
},
make_footer: function() {
$("<br>").appendTo(this.parent);
$p = $('<p style="font-size: 80%;" class="text-muted pull-right"></p>').appendTo(this.parent);
$('<div class="clearfix">').appendTo(this.parent);

if(this.obj._gh_source) {
$("<br>").appendTo(this.parent);
$(repl('<p><a href="%(source)s" target="_blank">\
<i class="icon-github"></i> Source: Improve this doc</i></a></p>', {
$(repl('<a href="%(source)s" target="_blank">\
<i class="icon-github"></i> Source</i></a>', {
source: this.obj._gh_source
})).appendTo(this.parent);
})).appendTo($p);
}
if(this.obj._modified) {
$(repl('<p class="text-muted" style="margin-top: 10px; font-size: 90%;">\
Last Updated: %(modified)s</p>', {
$(repl("<span>" + (this.obj._gh_source ? " | " : "") + 'Last Updated: %(modified)s</span>', {
modified: wn.datetime.global_date_format(this.obj._modified)
})).appendTo(this.parent);
})).appendTo($p);
}
},
make_links: function() {


+ 4
- 1
core/doctype/documentation_tool/documentation_tool.py View File

@@ -40,7 +40,10 @@ def get_static_pages():
with open(fpath, "r") as docfile:
src = unicode(docfile.read(), "utf-8")
temp, headers, body = src.split("---", 2)
d = json.loads(headers)
try:
d = json.loads(headers)
except Exception, e:
webnotes.msgprint("Bad Headers in: " + fname)
d["_intro"] = body
d["_gh_source"] = get_gh_url(fpath)
d["_modified"] = get_timestamp(fpath)


+ 1
- 1
docs/docs.dev.framework.md View File

@@ -1,6 +1,6 @@
---
{
"_label": "Framework API",
"_label": "Framework",
"_toc": [
"docs.dev.framework.server",
"docs.dev.framework.client"


+ 1
- 1
public/js/wn/ui/toolbar/bookmarks.js View File

@@ -4,7 +4,7 @@ wn.ui.toolbar.Bookmarks = Class.extend({
$('.navbar .nav:first').append('<li class="dropdown">\
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
title="'+wn._("Bookmarks")+'"\
onclick="return false;">Bookmarks</a>\
onclick="return false;">'+wn._("Bookmarks")+'</a>\
<ul class="dropdown-menu" id="toolbar-bookmarks">\
<li class="divider"></li>\
<li><a href="#" id="add-bookmark-link"><i class="icon-plus"></i> '


+ 1
- 1
public/js/wn/ui/toolbar/recent.js View File

@@ -26,7 +26,7 @@ wn.ui.toolbar.RecentDocs = Class.extend({
$('.navbar .nav:first').append('<li class="dropdown">\
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
title="'+wn._("History")+'"\
onclick="return false;">History</i></a>\
onclick="return false;">'+wn._("History")+'</i></a>\
<ul class="dropdown-menu" id="toolbar-recent"></ul>\
</li>');
this.setup();


+ 1
- 1
public/js/wn/ui/toolbar/toolbar.js View File

@@ -154,7 +154,7 @@ wn.ui.toolbar.Toolbar = Class.extend({
$('.navbar .nav:first').append('<li class="dropdown">\
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
title="'+wn._("Tools")+'"\
onclick="return false;">Tools</a>\
onclick="return false;">'+wn._("Tools")+'</a>\
<ul class="dropdown-menu" id="toolbar-tools">\
<li><a href="#" onclick="return wn.ui.toolbar.clear_cache();">'
+wn._('Clear Cache & Refresh')+'</a></li>\


+ 10
- 11
webnotes/__init__.py View File

@@ -441,18 +441,17 @@ def get_config():
if not _config:
import webnotes.utils, json
def update_config(path):
with open(path, "r") as configfile:
this_config = json.loads(configfile.read())
_config.modules.update(this_config["modules"])
_config.web.pages.update(this_config["web"]["pages"])
_config.web.generators.update(this_config["web"]["generators"])
_config = _dict({"modules": {}, "web": _dict({"pages": {}, "generators": {}})})
with open(webnotes.utils.get_path("lib", "config.json"), "r") as configf:
framework_config = json.loads(configf.read())
_config.modules.update(framework_config["modules"])
_config.web.pages.update(framework_config["web"]["pages"])
_config.web.generators.update(framework_config["web"]["generators"])
with open(webnotes.utils.get_path("app", "config.json"), "r") as configf:
app_config = json.loads(configf.read())
_config.modules.update(app_config["modules"])
_config.web.pages.update(app_config["web"]["pages"])
_config.web.generators.update(app_config["web"]["generators"])
update_config(webnotes.utils.get_path("lib", "config.json"))
update_config(webnotes.utils.get_path("app", "config.json"))
return _config

+ 6
- 23
webnotes/translate.py View File

@@ -111,8 +111,6 @@ def build_message_files():
build_for_framework('lib/public/js/wn', 'js')
build_for_framework('app/public/js', 'js', with_doctype_names=True)
#build_for_modules()

def build_for_pages(path):
"""make locale files for framework py and js (all)"""
messages = []
@@ -129,27 +127,6 @@ def build_for_pages(path):
if messages_py:
write_messages_file(basepath, messages_py, "py")

def build_for_modules():
"""doctype descriptions, module names, etc for each module"""
from webnotes.modules import get_module_path, get_doc_path
for m in webnotes.conn.sql("""select name from `tabModule Def`"""):
module_path = get_module_path(m[0])
if os.path.exists(module_path):
messages = []
messages += [t[0] for t in webnotes.conn.sql("""select description from tabDocType
where module=%s""", m[0])]
for t in webnotes.conn.sql("""select
if(ifnull(title,'')='',name,title)
from tabPage where module=%s
and ifnull(standard,'No')='Yes' """, m[0]):
messages.append(t[0])
messages += [t[0] for t in webnotes.conn.sql("""select t1.name from
tabReport t1, tabDocType t2 where
t1.ref_doctype = t2.name and
t1.is_standard = "Yes" and
t2.module = %s""", m[0])]

doctype_path = get_doc_path(m[0], 'Module Def', m[0])
write_messages_file(doctype_path, messages, 'doc')

@@ -206,6 +183,12 @@ def build_for_framework(path, mtype, with_doctype_names = False):
for m in webnotes.conn.sql("""select name, module from `tabDocType`"""):
messages.append(m[0])
messages.append(m[1])
# append labels from config.json
config = webnotes.get_config()
for m in config["modules"]:
if m.get("label"):
messages.append(m["label"])
if messages:
write_messages_file(path, messages, mtype)


Loading…
Cancel
Save