diff options
Diffstat (limited to 'public')
-rw-r--r-- | public/css/cover.css | 4 | ||||
-rw-r--r-- | public/js/cover.js | 2 | ||||
-rw-r--r-- | public/js/locale.js | 24 | ||||
-rw-r--r-- | public/views/body.ejs | 60 | ||||
-rw-r--r-- | public/views/header.ejs | 52 | ||||
-rw-r--r-- | public/views/help-modal.ejs | 76 | ||||
-rw-r--r-- | public/views/index.ejs | 69 | ||||
-rw-r--r-- | public/views/refresh-modal.ejs | 18 | ||||
-rw-r--r-- | public/views/revision-modal.ejs | 8 | ||||
-rw-r--r-- | public/views/signin-modal.ejs | 14 |
10 files changed, 180 insertions, 147 deletions
diff --git a/public/css/cover.css b/public/css/cover.css index bde3ec7c..ca0c6027 100644 --- a/public/css/cover.css +++ b/public/css/cover.css @@ -329,6 +329,10 @@ input { vertical-align: middle !important; } +select { + color: black; +} + @media (max-width: 768px) { span.ui-or { display: block; diff --git a/public/js/cover.js b/public/js/cover.js index c97bd256..f3533826 100644 --- a/public/js/cover.js +++ b/public/js/cover.js @@ -291,7 +291,7 @@ $(".ui-logout").click(function () { var filtertags = []; $(".ui-use-tags").select2({ - placeholder: 'Select tags...', + placeholder: $(".ui-use-tags").attr('placeholder'), multiple: true, data: function () { return { diff --git a/public/js/locale.js b/public/js/locale.js new file mode 100644 index 00000000..6fe7fdb6 --- /dev/null +++ b/public/js/locale.js @@ -0,0 +1,24 @@ +var lang = "en"; +var userLang = navigator.language || navigator.userLanguage; +var userLangCode = userLang.split('-')[0]; +var userCountryCode = userLang.split('-')[1]; +var locale = $('.ui-locale'); +var supportLangs = []; +$(".ui-locale option").each(function() { + supportLangs.push($(this).val()); +}); +if (Cookies.get('locale')) { + lang = Cookies.get('locale'); +} else if (supportLangs.indexOf(userLang) !== -1) { + lang = supportLangs[supportLangs.indexOf(userLang)]; +} else if (supportLangs.indexOf(userLangCode) !== -1) { + lang = supportLangs[supportLangs.indexOf(userLangCode)]; +} + +locale.val(lang); +locale.change(function() { + Cookies.set('locale', $(this).val(), { + expires: 365 + }); + window.location.reload(); +});
\ No newline at end of file diff --git a/public/views/body.ejs b/public/views/body.ejs index acf929ad..28680e49 100644 --- a/public/views/body.ejs +++ b/public/views/body.ejs @@ -43,15 +43,15 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="myModalLabel">Import from clipboard</h4> + <h4 class="modal-title" id="myModalLabel"><%= __('Import from clipboard') %></h4> </div> <div class="modal-body"> - <div contenteditable data-ph="Paste your markdown or webpage here..." id="clipboardModalContent" style="overflow:auto;max-height:50vh"></div> + <div contenteditable data-ph="<%= __('Paste your markdown or webpage here...') %>" id="clipboardModalContent" style="overflow:auto;max-height:50vh"></div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> - <button type="button" class="btn btn-danger" id="clipboardModalClear">Clear</button> - <button type="button" class="btn btn-primary" id="clipboardModalConfirm">Import</button> + <button type="button" class="btn btn-default" data-dismiss="modal"><%= __('Cancel') %></button> + <button type="button" class="btn btn-danger" id="clipboardModalClear"><%= __('Clear') %></button> + <button type="button" class="btn btn-primary" id="clipboardModalConfirm"><%= __('Import') %></button> </div> </div> </div> @@ -63,13 +63,13 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="myModalLabel"><i class="fa fa-lock"></i> This note is locked</h4> + <h4 class="modal-title" id="myModalLabel"><i class="fa fa-lock"></i> <%= __('This note is locked') %></h4> </div> <div class="modal-body" style="color:black;"> - <h5>Sorry, only owner can edit this note.</h5> + <h5><%= __('Sorry, only owner can edit this note.') %></h5> </div> <div class="modal-footer"> - <button type="button" class="btn btn-danger" data-dismiss="modal">OK</button> + <button type="button" class="btn btn-danger" data-dismiss="modal"><%= __('OK') %></button> </div> </div> </div> @@ -81,14 +81,14 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="myModalLabel"><i class="fa fa-exclamation-triangle"></i> Reach the limit</h4> + <h4 class="modal-title" id="myModalLabel"><i class="fa fa-exclamation-triangle"></i> <%= __('Reach the limit') %></h4> </div> <div class="modal-body" style="color:black;"> - <h5>Sorry, you've reached the max length this note can be.</h5> - <strong>Please reduce the content or divide it to more notes, thank you!</strong> + <h5><%= __("Sorry, you've reached the max length this note can be.") %></h5> + <strong><%= __('Please reduce the content or divide it to more notes, thank you!') %></strong> </div> <div class="modal-footer"> - <button type="button" class="btn btn-warning" data-dismiss="modal">OK</button> + <button type="button" class="btn btn-warning" data-dismiss="modal"><%= __('OK') %></button> </div> </div> </div> @@ -107,7 +107,7 @@ <a target="_blank" style="word-break: break-all;"></a> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">OK</button> + <button type="button" class="btn btn-default" data-dismiss="modal"><%= __('OK') %></button> </div> </div> </div> @@ -119,15 +119,15 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="myModalLabel">Import from Gist</h4> + <h4 class="modal-title" id="myModalLabel"><%= __('Import from Gist') %></h4> </div> <div class="modal-body"> - <input type="url" class="form-control" placeholder="Paste your gist url here... (like: https://gist.github.com/username/gistid)" id="gistImportModalContent"> + <input type="url" class="form-control" placeholder="<%= __('Paste your gist url here...') %> (like: https://gist.github.com/username/gistid)" id="gistImportModalContent"> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> - <button type="button" class="btn btn-danger" id="gistImportModalClear">Clear</button> - <button type="button" class="btn btn-primary" id="gistImportModalConfirm">Import</button> + <button type="button" class="btn btn-default" data-dismiss="modal"><%= __('Cancel') %></button> + <button type="button" class="btn btn-danger" id="gistImportModalClear"><%= __('Clear') %></button> + <button type="button" class="btn btn-primary" id="gistImportModalConfirm"><%= __('Import') %></button> </div> </div> </div> @@ -139,7 +139,7 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="myModalLabel">Import from Snippet</h4> + <h4 class="modal-title" id="myModalLabel"><%= __('Import from Snippet') %></h4> </div> <div class="modal-body"> <input type="hidden" id="snippetImportModalAccessToken" /> @@ -148,24 +148,24 @@ <div style="display:table-row;margin-bottom:5px;"> <label style="display:table-cell;">Project:</label> <select class="form-control" id="snippetImportModalProjects" style="display:table-cell;" disabled="disabled"> - <option value="init" selected="selected" disabled="disabled">Select From Available Projects</option> + <option value="init" selected="selected" disabled="disabled"><%= __('Select From Available Projects') %></option> </select> </div> <div style="display:table-row;"> <label style="display:table-cell;">Snippet</label> <select class="form-control" id="snippetImportModalSnippets" style="display:table-cell;" disabled="disabled"> - <option value="init" selected="selected" disabled="disabled">Select From Available Snippets</option> + <option value="init" selected="selected" disabled="disabled"><%= __('Select From Available Snippets') %></option> </select> </div> </div> - <p class="snippet-import-or">OR</p> + <p class="snippet-import-or"><%= __('OR') %></p> <input type="url" class="form-control" placeholder="/projects/:id/snippets/:snippet_id" id="snippetImportModalContent" disabled="disabled"> </div> <div class="modal-footer"> <span id="snippetImportModalLoading"><i class="fa fa-refresh fa-spin fa-fw"></i></span> - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> - <button type="button" class="btn btn-danger" id="snippetImportModalClear">Clear</button> - <button type="button" class="btn btn-primary" id="snippetImportModalConfirm" disabled="disabled">Import</button> + <button type="button" class="btn btn-default" data-dismiss="modal"><%= __('Cancel') %></button> + <button type="button" class="btn btn-danger" id="snippetImportModalClear"><%= __('Clear') %></button> + <button type="button" class="btn btn-primary" id="snippetImportModalConfirm" disabled="disabled"><%= __('Import') %></button> </div> </div> </div> @@ -177,7 +177,7 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="myModalLabel">Export to Snippet</h4> + <h4 class="modal-title" id="myModalLabel"><%= __('Export to Snippet') %></h4> </div> <div class="modal-body"> <input type="hidden" id="snippetExportModalAccessToken" /> @@ -194,13 +194,13 @@ <div style="display:table-row;margin-bottom:5px;"> <label style="display:table-cell;">Project:</label> <select class="form-control" id="snippetExportModalProjects" style="display:table-cell;"> - <option value="init" selected="selected" disabled="disabled">Select From Available Projects</option> + <option value="init" selected="selected" disabled="disabled"><%= __('Select From Available Projects') %></option> </select> </div> <div style="display:table-row;margin-bottom:5px;"> <label style="display:table-cell;">Visibility:</label> <select class="form-control" id="snippetExportModalVisibility" style="display:table-cell;"> - <option value="" selected="selected" disabled="disabled">Select Visibility Level</option> + <option value="" selected="selected" disabled="disabled"><%= __('Select Visibility Level') %></option> <option value="0">Private</option> <option value="10">Internal</option> </select> @@ -209,8 +209,8 @@ </div> <div class="modal-footer"> <span id="snippetExportModalLoading"><i class="fa fa-refresh fa-spin fa-fw"></i></span> - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> - <button type="button" class="btn btn-primary" id="snippetExportModalConfirm">Export</button> + <button type="button" class="btn btn-default" data-dismiss="modal"><%= __('Cancel') %></button> + <button type="button" class="btn btn-primary" id="snippetExportModalConfirm"><%= __('Export') %></button> </div> </div> </div> diff --git a/public/views/header.ejs b/public/views/header.ejs index 67760665..d2b1ec1e 100644 --- a/public/views/header.ejs +++ b/public/views/header.ejs @@ -22,18 +22,18 @@ <i class="fa fa-caret-down"></i> </a> <ul class="dropdown-menu list" role="menu" aria-labelledby="menu"> - <li role="presentation"><a role="menuitem" class="ui-new" tabindex="-1" href="<%- url %>/new" target="_blank"><i class="fa fa-plus fa-fw"></i> New</a> + <li role="presentation"><a role="menuitem" class="ui-new" tabindex="-1" href="<%- url %>/new" target="_blank"><i class="fa fa-plus fa-fw"></i> <%= __('New') %></a> </li> - <li role="presentation"><a role="menuitem" class="ui-publish" tabindex="-1" href="#" target="_blank"><i class="fa fa-print fa-fw"></i> Publish</a> + <li role="presentation"><a role="menuitem" class="ui-publish" tabindex="-1" href="#" target="_blank"><i class="fa fa-print fa-fw"></i> <%= __('Publish') %></a> </li> <li class="divider"></li> - <li class="dropdown-header">Extra</li> - <li role="presentation"><a role="menuitem" class="ui-extra-revision" tabindex="-1" data-toggle="modal" data-target="#revisionModal"><i class="fa fa-history fa-fw"></i> Revision</a> + <li class="dropdown-header"><%= __('Extra') %></li> + <li role="presentation"><a role="menuitem" class="ui-extra-revision" tabindex="-1" data-toggle="modal" data-target="#revisionModal"><i class="fa fa-history fa-fw"></i> <%= __('Revision') %></a> </li> - <li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-tv fa-fw"></i> Slide Mode</a> + <li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a> </li> <li class="divider"></li> - <li class="dropdown-header">Export</li> + <li class="dropdown-header"><%= __('Export') %></li> <li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a> </li> <li role="presentation"><a role="menuitem" class="ui-save-google-drive" tabindex="-1" href="#" target="_self"><i class="fa fa-cloud-upload fa-fw"></i> Google Drive</a> @@ -47,7 +47,7 @@ </li> <% } %> <li class="divider"></li> - <li class="dropdown-header">Import</li> + <li class="dropdown-header"><%= __('Import') %></li> <li role="presentation"><a role="menuitem" class="ui-import-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a> </li> <li role="presentation"><a role="menuitem" class="ui-import-google-drive" tabindex="-1" href="#" target="_self"><i class="fa fa-cloud-download fa-fw"></i> Google Drive</a> @@ -58,15 +58,15 @@ <li role="presentation"><a role="menuitem" class="ui-import-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> </li> <% } %> - <li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> Clipboard</a> + <li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> <%= __('Clipboard') %></a> </li> <li class="divider"></li> - <li class="dropdown-header">Download</li> + <li class="dropdown-header"><%= __('Download') %></li> <li role="presentation"><a role="menuitem" class="ui-download-markdown" tabindex="-1" href="#" target="_self"><i class="fa fa-file-text fa-fw"></i> Markdown</a> </li> <li role="presentation"><a role="menuitem" class="ui-download-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> HTML</a> </li> - <li role="presentation"><a role="menuitem" class="ui-download-raw-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> Raw HTML</a> + <li role="presentation"><a role="menuitem" class="ui-download-raw-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> <%= __('Raw HTML') %></a> </li> <li role="presentation"><a role="menuitem" class="ui-download-pdf-beta" tabindex="-1" href="#" target="_self"><i class="fa fa-file-pdf-o fa-fw"></i> PDF (Beta)</a> </li> @@ -82,20 +82,20 @@ <div class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-form navbar-left" style="padding:0;"> <div class="btn-group" data-toggle="buttons"> - <label class="btn btn-default ui-edit" title="Edit"> + <label class="btn btn-default ui-edit" title="<%= __('Edit') %>"> <input type="radio" name="mode" autocomplete="off"><i class="fa fa-edit"></i> </label> - <label class="btn btn-default ui-view" title="View"> + <label class="btn btn-default ui-view" title="<%= __('View') %>"> <input type="radio" name="mode" autocomplete="off"><i class="fa fa-eye"></i> </label> - <label class="btn btn-default ui-both" title="Both"> + <label class="btn btn-default ui-both" title="<%= __('Both') %>"> <input type="radio" name="mode" autocomplete="off"><i class="fa fa-columns"></i> </label> </div> - <span class="btn btn-link btn-file ui-help" title="Help" data-toggle="modal" data-target=".help-modal"> + <span class="btn btn-link btn-file ui-help" title="<%= __('Help') %>" data-toggle="modal" data-target=".help-modal"> <i class="fa fa-question-circle"></i> </span> - <span class="btn btn-link btn-file ui-upload-image" title="Upload Image" style="display:none;"> + <span class="btn btn-link btn-file ui-upload-image" title="<%= __('Upload Image') %>" style="display:none;"> <i class="fa fa-camera"></i><input type="file" accept="image/*" name="upload" multiple> </span> </ul> @@ -111,26 +111,26 @@ <ul class="nav navbar-nav navbar-right" style="padding:0;"> <li> <a href="<%- url %>/new" target="_blank" class="ui-new"> - <i class="fa fa-plus"></i> New + <i class="fa fa-plus"></i> <%= __('New') %> </a> </li> <li> <a href="#" target="_blank" class="ui-publish"> - <i class="fa fa-print"></i> Publish + <i class="fa fa-print"></i> <%= __('Publish') %> </a> </li> <li> <a data-toggle="dropdown"> - Menu <i class="fa fa-caret-down"></i> + <%= __('Menu') %> <i class="fa fa-caret-down"></i> </a> <ul class="dropdown-menu list" role="menu" aria-labelledby="menu"> - <li class="dropdown-header">Extra</li> - <li role="presentation"><a role="menuitem" class="ui-extra-revision" tabindex="-1" data-toggle="modal" data-target="#revisionModal"><i class="fa fa-history fa-fw"></i> Revision</a> + <li class="dropdown-header"><%= __('Extra') %></li> + <li role="presentation"><a role="menuitem" class="ui-extra-revision" tabindex="-1" data-toggle="modal" data-target="#revisionModal"><i class="fa fa-history fa-fw"></i> <%= __('Revision') %></a> </li> - <li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-tv fa-fw"></i> Slide Mode</a> + <li role="presentation"><a role="menuitem" class="ui-extra-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-tv fa-fw"></i> <%= __('Slide Mode') %></a> </li> <li class="divider"></li> - <li class="dropdown-header">Export</li> + <li class="dropdown-header"><%= __('Export') %></li> <li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a> </li> <li role="presentation"><a role="menuitem" class="ui-save-google-drive" tabindex="-1" href="#" target="_self"><i class="fa fa-cloud-upload fa-fw"></i> Google Drive</a> @@ -144,7 +144,7 @@ </li> <% } %> <li class="divider"></li> - <li class="dropdown-header">Import</li> + <li class="dropdown-header"><%= __('Import') %></li> <li role="presentation"><a role="menuitem" class="ui-import-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a> </li> <li role="presentation"><a role="menuitem" class="ui-import-google-drive" tabindex="-1" href="#" target="_self"><i class="fa fa-cloud-download fa-fw"></i> Google Drive</a> @@ -155,15 +155,15 @@ <li role="presentation"><a role="menuitem" class="ui-import-snippet" href="#"><i class="fa fa-gitlab fa-fw"></i> Snippet</a> </li> <% } %> - <li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> Clipboard</a> + <li role="presentation"><a role="menuitem" class="ui-import-clipboard" href="#" data-toggle="modal" data-target="#clipboardModal"><i class="fa fa-clipboard fa-fw"></i> <%= __('Clipboard') %></a> </li> <li class="divider"></li> - <li class="dropdown-header">Download</li> + <li class="dropdown-header"><%= __('Download') %></li> <li role="presentation"><a role="menuitem" class="ui-download-markdown" tabindex="-1" href="#" target="_self"><i class="fa fa-file-text fa-fw"></i> Markdown</a> </li> <li role="presentation"><a role="menuitem" class="ui-download-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> HTML</a> </li> - <li role="presentation"><a role="menuitem" class="ui-download-raw-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> Raw HTML</a> + <li role="presentation"><a role="menuitem" class="ui-download-raw-html" tabindex="-1" href="#" target="_self"><i class="fa fa-file-code-o fa-fw"></i> <%= __('Raw HTML') %></a> </li> <li role="presentation"><a role="menuitem" class="ui-download-pdf-beta" tabindex="-1" href="#" target="_self"><i class="fa fa-file-pdf-o fa-fw"></i> PDF (Beta)</a> </li> diff --git a/public/views/help-modal.ejs b/public/views/help-modal.ejs index 3a4fe22b..3d119e8b 100644 --- a/public/views/help-modal.ejs +++ b/public/views/help-modal.ejs @@ -5,79 +5,79 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="mySmallModalLabel"><i class="fa fa-question-circle"></i> Help</h4> + <h4 class="modal-title" id="mySmallModalLabel"><i class="fa fa-question-circle"></i> <%= __('Help') %></h4> </div> <div class="modal-body"> <div class="row"> <div class="col-lg-3"> <div class="panel panel-default"> <div class="panel-heading"> - <h3 class="panel-title">Contacts</h3> + <h3 class="panel-title"><%= __('Contacts') %></h3> </div> <div class="panel-body"> - <a href="https://github.com/hackmdio/hackmd/issues" title="Report an issue" target="_blank"><i class="fa fa-tag fa-fw"></i> Report an issue</a> + <a href="https://github.com/hackmdio/hackmd/issues" target="_blank"><i class="fa fa-tag fa-fw"></i> <%= __('Report an issue') %></a> <br> - <a href="mailto:hackmdio@gmail.com" title="Send us email"><i class="fa fa-envelope fa-fw"></i> Send us email</a> + <a href="mailto:hackmdio@gmail.com"><i class="fa fa-envelope fa-fw"></i> <%= __('Send us email') %></a> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> - <h3 class="panel-title">Documents</h3> + <h3 class="panel-title"><%= __('Documents') %></h3> </div> <div class="panel-body"> - <a href="./features" title="Features" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> Features</a> + <a href="./features" title="Features" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> <%= __('Features') %></a> <br> - <a href="./yaml-metadata" title="YAML Metadata" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> YAML Metadata</a> + <a href="./yaml-metadata" title="YAML Metadata" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> <%= __('YAML Metadata') %></a> <br> - <a href="./slide-example" title="Slide Example" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> Slide Example</a> + <a href="./slide-example" title="Slide Example" target="_blank"><i class="fa fa-dot-circle-o fa-fw"></i> <%= __('Slide Example') %></a> </div> </div> </div> <div class="col-lg-9"> <div class="panel panel-default"> <div class="panel-heading"> - <h3 class="panel-title">Cheatsheet</h3> + <h3 class="panel-title"><%= __('Cheatsheet') %></h3> </div> <div class="panel-body" style="height: calc(100vh - 215px); overflow: auto;"> <table class="table table-condensed"> <thead> <tr> - <th>Example</th> - <th>Syntax</th> + <th><%= __('Example') %></th> + <th><%= __('Syntax') %></th> </tr> </thead> <tbody class="markdown-body" style="font-family: inherit; font-size: 14px; padding: 0; max-width: inherit;"> <tr> - <td>Header</td> - <td># Header</td> + <td><%= __('Header') %></td> + <td># <%= __('Header') %></td> </tr> <tr> - <td><ul><li>Unordered List</li></ul></td> - <td>- Unordered List</td> + <td><ul><li><%= __('Unordered List') %></li></ul></td> + <td>- <%= __('Unordered List') %></td> </tr> <tr> - <td><ol><li>Ordered List</li></ol></td> - <td>1. Ordered List</td> + <td><ol><li><%= __('Ordered List') %></li></ol></td> + <td>1. <%= __('Ordered List') %></td> </tr> <tr> - <td><ul><li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled><label></label>Todo List</li></ul></td> - <td>- [ ] Todo List</td> + <td><ul><li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled><label></label><%= __('Todo List') %></li></ul></td> + <td>- [ ] <%= __('Todo List') %></td> </tr> <tr> - <td><blockquote> Blockquote</blockquote></td> - <td>> Blockquote</td> + <td><blockquote> <%= __('Blockquote') %></blockquote></td> + <td>> <%= __('Blockquote') %></td> </tr> <tr> - <td><strong>Bold font</strong></td> - <td>**Bold font**</td> + <td><strong><%= __('Bold font') %></strong></td> + <td>**<%= __('Bold font') %>**</td> </tr> <tr> - <td><i>Italics font</i></td> - <td>*Italics font*</td> + <td><i><%= __('Italics font') %></i></td> + <td>*<%= __('Italics font') %>*</td> </tr> <tr> - <td><s>Strikethrough</s></td> - <td>~~strikethrough~~</td> + <td><s><%= __('Strikethrough') %></s></td> + <td>~~<%= __('Strikethrough') %>~~</td> </tr> <tr> <td>19<sup>th</sup></td> @@ -88,24 +88,24 @@ <td>H~2~O</td> </tr> <tr> - <td><ins>Inserted text</ins></td> - <td>++Inserted text++</td> + <td><ins><%= __('Inserted text') %></ins></td> + <td>++<%= __('Inserted text') %>++</td> </tr> <tr> - <td><mark>Marked text</mark></td> - <td>==Marked text==</td> + <td><mark><%= __('Marked text') %></mark></td> + <td>==<%= __('Marked text') %>==</td> </tr> <tr> - <td><a>Link</a></td> + <td><a><%= __('Link') %></a></td> <td>[link text](https:// "title")</td> </tr> <tr> - <td>Image</td> + <td><%= __('Image') %></td> <td>![image alt](https:// "title")</td> </tr> <tr> - <td><code>Code</code></td> - <td>`code`</td> + <td><code><%= __('Code') %></code></td> + <td>`<%= __('Code') %>`</td> </tr> <tr> <td><pre style="border:none !important;"><code class="javascript hljs"><div class="wrapper"><div class="gutter linenumber"><span data-linenumber="1"></span></div><div class="code"><span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; @@ -117,7 +117,7 @@ <td>:smile:</td> </tr> <tr> - <td>Externals</td> + <td><%= __('Externals') %></td> <td>{%youtube youtube_id %}</td> </tr> <tr> @@ -125,8 +125,8 @@ <td>$L^aT_eX$</td> </tr> <tr> - <td><div class="alert alert-info"><p>This is a alert area.</p></div></td> - <td>:::info<br>This is a alert area.<br>:::</td> + <td><div class="alert alert-info"><p><%= __('This is a alert area.') %></p></div></td> + <td>:::info<br><%= __('This is a alert area.') %><br>:::</td> </tr> </tbody> </table> diff --git a/public/views/index.ejs b/public/views/index.ejs index daf123b1..8c4cf101 100644 --- a/public/views/index.ejs +++ b/public/views/index.ejs @@ -8,9 +8,9 @@ <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="mobile-web-app-capable" content="yes"> - <meta name="description" content="Best way to write and share your knowledge in markdown."> + <meta name="description" content="<%= __('Best way to write and share your knowledge in markdown.') %>"> <meta name="keywords" content="Collaborative, Markdown, Notes"> - <title>HackMD - Collaborative markdown notes</title> + <title>HackMD - <%= __('Collaborative markdown notes') %></title> <link rel="icon" type="image/png" href="<%- url %>/favicon.png"> <link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png"> @@ -41,9 +41,9 @@ <h3 class="masthead-brand"></h3> <nav> <ul class="nav masthead-nav"> - <li class="ui-home<% if(!signin) { %> active<% } %>"><a href="#">Intro</a> + <li class="ui-home<% if(!signin) { %> active<% } %>"><a href="#"><%= __('Intro') %></a> </li> - <li class="ui-history<% if(signin) { %> active<% } %>"><a href="#">History</a> + <li class="ui-history<% if(signin) { %> active<% } %>"><a href="#"><%= __('History') %></a> </li> </ul> </nav> @@ -54,17 +54,17 @@ <div class="inner cover"> <h1 class="cover-heading"><i class="fa fa-file-text"></i> HackMD</h1> <p class="lead"> - Best way to write and share your knowledge in markdown. + <%= __('Best way to write and share your knowledge in markdown.') %> </p> <% if(facebook || twitter || github || gitlab || dropbox || google) { %> <span class="ui-signin"> <br> - <a type="button" class="btn btn-lg btn-success ui-signin" data-toggle="modal" data-target=".signin-modal" style="width: 170px;">Sign In</a> + <a type="button" class="btn btn-lg btn-success ui-signin" data-toggle="modal" data-target=".signin-modal" style="width: 170px;"><%= __('Sign In') %></a> </span> - <span class="ui-or">or</span> + <span class="ui-or"><%= __('or') %></span> <% }%> <span class="ui-signin"> - <a href="<%- url %>/new" class="btn btn-lg btn-default" style="width: 170px;">New guest note</a> + <a href="<%- url %>/new" class="btn btn-lg btn-default" style="width: 170px;"><%= __('New guest note') %></a> <br> <br> </span> @@ -72,19 +72,19 @@ <div class="col-md-4 inner"> <a href="<%- url %>/features#share-note"> <i class="fa fa-bolt fa-3x"></i> - <h4>Collaborate with URL</h4> + <h4><%= __('Collaborate with URL') %></h4> </a> </div> <div class="col-md-4 inner"> <a href="<%- url %>/features#mathjax"> <i class="fa fa-bar-chart fa-3x"></i> - <h4>Support charts and MathJax</h4> + <h4><%= __('Support charts and MathJax') %></h4> </a> </div> <div class="col-md-4 inner"> <a href="<%- url %>/features#slide-mode"> <i class="fa fa-tv fa-3x"></i> - <h4>Support slide mode</h4> + <h4><%= __('Support slide mode') %></h4> </a> </div> </div> @@ -94,45 +94,45 @@ <div id="history" class="section"<% if(!signin) { %> style="display:none;"<% } %>> <% if(facebook || twitter || github || gitlab || dropbox || google) { %> <div class="ui-signin"> - <p>Below is the history from browser</p> + <p><%= __('Below is the history from browser') %></p> </div> <div class="ui-signout" style="display:none;"> <img class="ui-avatar"> - <h4 class="ui-welcome">Welcome! <span class="ui-name"></span></h4> - <a href="<%- url %>/new" class="btn btn-md btn-default">New note</a> or - <a href="#" class="btn btn-danger ui-logout">Sign Out</a> + <h4 class="ui-welcome"><%= __('Welcome!') %> <span class="ui-name"></span></h4> + <a href="<%- url %>/new" class="btn btn-md btn-default"><%= __('New note') %></a> <%= __('or') %> + <a href="#" class="btn btn-danger ui-logout"><%= __('Sign Out') %></a> </div> <% }%> <h4> - <a type="button" href="<%- url %>/features" class="btn btn-primary">Explore all features</a> + <a type="button" href="<%- url %>/features" class="btn btn-primary"><%= __('Explore all features') %></a> </h4> <hr> <form class="form-inline"> <div class="form-group" style="vertical-align: bottom;"> - <input class="form-control ui-use-tags" /> + <input class="form-control ui-use-tags" placeholder="<%= __('Select tags...') %>" /> </div> <div class="form-group"> - <input class="search form-control" placeholder="Search keyword..." /> + <input class="search form-control" placeholder="<%= __('Search keyword...') %>" /> </div> - <a href="#" class="sort btn btn-default" data-sort="text" title="Sort by title"> - Title + <a href="#" class="sort btn btn-default" data-sort="text" title="<%= __('Sort by title') %>"> + <%= __('Title') %> </a> - <a href="#" class="sort btn btn-default" data-sort="timestamp" title="Sort by time"> - Time + <a href="#" class="sort btn btn-default" data-sort="timestamp" title="<%= __('Sort by time') %>"> + <%= __('Time') %> </a> <span class="hidden-xs hidden-sm"> - <a href="#" class="btn btn-default ui-save-history" title="Export history"><i class="fa fa-save"></i></a> - <span class="btn btn-default btn-file ui-open-history" title="Import history"> + <a href="#" class="btn btn-default ui-save-history" title="<%= __('Export history') %>"><i class="fa fa-save"></i></a> + <span class="btn btn-default btn-file ui-open-history" title="<%= __('Import history') %>"> <i class="fa fa-folder-open-o"></i><input type="file" /> </span> - <a href="#" class="btn btn-default ui-clear-history" title="Clear history" data-toggle="modal" data-target=".delete-modal"><i class="fa fa-trash-o"></i></a> + <a href="#" class="btn btn-default ui-clear-history" title="<%= __('Clear history') %>" data-toggle="modal" data-target=".delete-modal"><i class="fa fa-trash-o"></i></a> </span> - <a href="#" class="btn btn-default ui-refresh-history" title="Refresh history"><i class="fa fa-refresh"></i></a> + <a href="#" class="btn btn-default ui-refresh-history" title="<%= __('Refresh history') %>"><i class="fa fa-refresh"></i></a> </form> <h4 class="ui-nohistory" style="display:none;"> - No history + <%= __('No history') %> </h4> - <a href="#" class="btn btn-primary ui-import-from-browser" style="display:none;">Import from browser</a> + <a href="#" class="btn btn-primary ui-import-from-browser" style="display:none;"><%= __('Import from browser') %></a> <ul id="history-list" class="list"> </ul> </div> @@ -143,8 +143,12 @@ <iframe src="//ghbtns.com/github-btn.html?user=hackmdio&repo=hackmd&type=star&count=true" frameborder="0" scrolling="0" width="90px" height="20px"></iframe> </h6> <p> - © 2016 <a href="https://www.facebook.com/TakeHackMD" target="_blank"><i class="fa fa-facebook-square"></i> HackMD</a> | <a href="<%- url %>/s/release-notes" target="_blank">Releases</a> + © 2016 <a href="https://www.facebook.com/TakeHackMD" target="_blank"><i class="fa fa-facebook-square"></i> HackMD</a> | <a href="<%- url %>/s/release-notes" target="_blank"><%= __('Releases') %></a> </p> + <select class="ui-locale"> + <option value="en">English</option> + <option value="zh">中文</option> + </select> </div> </div> </div> @@ -157,15 +161,15 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="myModalLabel">Are you sure?</h4> + <h4 class="modal-title" id="myModalLabel"><%= __('Are you sure?') %></h4> </div> <div class="modal-body" style="color:black;"> <h5 class="ui-delete-modal-msg"></h5> <strong class="ui-delete-modal-item"></strong> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> - <button type="button" class="btn btn-danger ui-delete-modal-confirm">Yes, do it!</button> + <button type="button" class="btn btn-default" data-dismiss="modal"><%= __('Cancel') %></button> + <button type="button" class="btn btn-danger ui-delete-modal-confirm"><%= __('Yes, do it!') %></button> </div> </div> </div> @@ -198,6 +202,7 @@ <script src="<%- url %>/js/common.js" defer></script> <script src="<%- url %>/js/history.js" defer></script> <script src="<%- url %>/js/cover.js" defer></script> + <script src="<%- url %>/js/locale.js" defer></script> </body> </html> diff --git a/public/views/refresh-modal.ejs b/public/views/refresh-modal.ejs index 07e3ecab..5be41b2a 100644 --- a/public/views/refresh-modal.ejs +++ b/public/views/refresh-modal.ejs @@ -5,26 +5,26 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="myModalLabel">This page need refresh</h4> + <h4 class="modal-title" id="myModalLabel"><%= __('This page need refresh') %></h4> </div> <div class="modal-body"> <div class="incompatible-version"> - <h5>You have an incompatible client version.</h5> - <strong>Refresh to update.</strong> + <h5><%= __('You have an incompatible client version.') %></h5> + <strong><%= __('Refresh to update.') %></strong> </div> <div class="new-version" style="display:none;"> - <h5>New version available!</h5> - <a href="<%- url %>/s/release-notes" target="_blank">See releases notes here</a> + <h5><%= __('New version available!') %></h5> + <a href="<%- url %>/s/release-notes" target="_blank"><%= __('See releases notes here') %></a> <br> - <strong>Refresh to enjoy new features.</strong> + <strong><%= __('Refresh to enjoy new features.') %></strong> </div> <div class="user-state-changed" style="display:none;"> - <h5>Your user state has changed.</h5> - <strong>Refresh to load new user state.</strong> + <h5><%= __('Your user state has changed.') %></h5> + <strong><%= __('Refresh to load new user state.') %></strong> </div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-primary" id="refreshModalRefresh">Refresh</button> + <button type="button" class="btn btn-primary" id="refreshModalRefresh"><%= __('Refresh') %></button> </div> </div> </div> diff --git a/public/views/revision-modal.ejs b/public/views/revision-modal.ejs index 008e62ac..f824cf06 100644 --- a/public/views/revision-modal.ejs +++ b/public/views/revision-modal.ejs @@ -5,7 +5,7 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="mySmallModalLabel"><i class="fa fa-history"></i> Revision</h4> + <h4 class="modal-title" id="mySmallModalLabel"><i class="fa fa-history"></i> <%= __('Revision') %></h4> </div> <div class="modal-body"> <div class="row"> @@ -18,9 +18,9 @@ </div> </div> <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> - <button type="button" class="btn btn-primary" id="revisionModalDownload">Download</button> - <button type="button" class="btn btn-danger" id="revisionModalRevert">Revert</button> + <button type="button" class="btn btn-default" data-dismiss="modal"><%= __('Cancel') %></button> + <button type="button" class="btn btn-primary" id="revisionModalDownload"><%= __('Download') %></button> + <button type="button" class="btn btn-danger" id="revisionModalRevert"><%= __('Revert') %></button> </div> </div> </div> diff --git a/public/views/signin-modal.ejs b/public/views/signin-modal.ejs index 293480b9..a3ca63f8 100644 --- a/public/views/signin-modal.ejs +++ b/public/views/signin-modal.ejs @@ -5,37 +5,37 @@ <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> - <h4 class="modal-title" id="mySmallModalLabel">Choose method</h4> + <h4 class="modal-title" id="mySmallModalLabel"><%= __('Choose method') %></h4> </div> <div class="modal-body"> <% if(facebook) { %> <a href="<%- url %>/auth/facebook" class="btn btn-lg btn-block btn-social btn-facebook"> - <i class="fa fa-facebook"></i> Sign in via Facebook + <i class="fa fa-facebook"></i> <%= __('Sign in via %s', 'Facebook') %> </a> <% } %> <% if(twitter) { %> <a href="<%- url %>/auth/twitter" class="btn btn-lg btn-block btn-social btn-twitter"> - <i class="fa fa-twitter"></i> Sign in via Twitter + <i class="fa fa-twitter"></i> <%= __('Sign in via %s', 'Twitter') %> </a> <% } %> <% if(github) { %> <a href="<%- url %>/auth/github" class="btn btn-lg btn-block btn-social btn-github"> - <i class="fa fa-github"></i> Sign in via GitHub + <i class="fa fa-github"></i> <%= __('Sign in via %s', 'GitHub') %> </a> <% } %> <% if(gitlab) { %> <a href="<%- url %>/auth/gitlab" class="btn btn-lg btn-block btn-social btn-soundcloud"> - <i class="fa fa-gitlab"></i> Sign in via GitLab + <i class="fa fa-gitlab"></i> <%= __('Sign in via %s', 'GitLab') %> </a> <% } %> <% if(dropbox) { %> <a href="<%- url %>/auth/dropbox" class="btn btn-lg btn-block btn-social btn-dropbox"> - <i class="fa fa-dropbox"></i> Sign in via Dropbox + <i class="fa fa-dropbox"></i> <%= __('Sign in via %s', 'Dropbox') %> </a> <% } %> <% if(google) { %> <a href="<%- url %>/auth/google" class="btn btn-lg btn-block btn-social btn-google"> - <i class="fa fa-google"></i> Sign in via Google + <i class="fa fa-google"></i> <%= __('Sign in via %s', 'Google') %> </a> <% } %> </div> |