mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-17 09:31:47 +00:00
jquery translations work
This commit is contained in:
parent
48f019236e
commit
bdf1fed462
8 changed files with 56 additions and 5 deletions
|
@ -50,6 +50,9 @@ module.exports = (app)->
|
|||
next()
|
||||
|
||||
app.use (req, res, next)->
|
||||
console.log req.i18n
|
||||
console.log req.i18n.t("profile_complete_percentage", {percent:88})
|
||||
console.log req.i18n.translate("profile_complete_percentage", {percent:87})
|
||||
res.locals.translate = req.i18n.translate
|
||||
next()
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ ignoreCsrfRoutes = []
|
|||
app.ignoreCsrf = (method, route) ->
|
||||
ignoreCsrfRoutes.push new express.Route(method, route)
|
||||
|
||||
|
||||
|
||||
app.configure () ->
|
||||
if Settings.behindProxy
|
||||
app.enable('trust proxy')
|
||||
|
@ -71,6 +73,8 @@ app.configure () ->
|
|||
|
||||
app.use ReferalConnect.use
|
||||
app.use express.methodOverride()
|
||||
app.use translations.serverStaticFiles
|
||||
|
||||
|
||||
expressLocals(app)
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ html(itemscope, itemtype='http://schema.org/Product')
|
|||
block vars
|
||||
|
||||
head
|
||||
|
||||
|
||||
- if (typeof(priority_title) !== "undefined" && priority_title)
|
||||
title= title + ' - Online LaTeX Editor ShareLaTeX'
|
||||
- else
|
||||
|
@ -34,6 +36,11 @@ html(itemscope, itemtype='http://schema.org/Product')
|
|||
block scripts
|
||||
script(src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js")
|
||||
script(src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.14/angular.min.js")
|
||||
script(src="/js/libs/i18next.js")
|
||||
//- script(src="/js/libs/ng-i18next/provider.js")
|
||||
//- script(src="/js/libs/ng-i18next/filter/filter.js")
|
||||
//- script(src="/js/libs/ng-i18next/directive/directive.js")
|
||||
|
||||
|
||||
script.
|
||||
window.sharelatex = {
|
||||
|
|
|
@ -3,6 +3,9 @@ extends ../layout
|
|||
block content
|
||||
//- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
|
||||
//- and doesn't prematurely end the script tag.
|
||||
|
||||
|
||||
|
||||
script(type="text/javascript").
|
||||
window.data = {
|
||||
projects: !{JSON.stringify(projects).replace(/\//g, '\\/')},
|
||||
|
@ -15,6 +18,17 @@ block content
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
$.i18n.init({
|
||||
lng: 'en-gb',
|
||||
fallbackLng: 'en',
|
||||
resGetPath: 'locales/__lng__.json'
|
||||
}, function() {
|
||||
console.log($.t('new_project')); // -> i18n (from en-US resourcefile)
|
||||
});
|
||||
|
||||
|
||||
.content.content-alt(ng-controller="ProjectPageController")
|
||||
.container
|
||||
.row
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
a.btn.btn-primary.dropdown-toggle(
|
||||
href="#",
|
||||
data-toggle="dropdown"
|
||||
) #{translate("new_project")}
|
||||
)
|
||||
p(ng-i18next="new_project")
|
||||
ul.dropdown-menu(role="menu")
|
||||
li
|
||||
a(
|
||||
|
@ -85,7 +86,7 @@
|
|||
.progress-bar.progress-bar-info(ng-style="{'width' : (percentComplete+'%')}")
|
||||
|
||||
p.small
|
||||
| #{translate("profile_complete_percentage", {percent:FIX ME})}
|
||||
| #{translate("profile_complete_percentage", {percent:"FIX ME"})}
|
||||
|
||||
button#completeUserProfileInformation.btn.btn-info(
|
||||
ng-hide="formVisable",
|
||||
|
|
|
@ -8,4 +8,8 @@ define [
|
|||
"libs/jquery.storage"
|
||||
"libs/fineuploader"
|
||||
"libs/angular-sanitize-1.2.17"
|
||||
"libs/i18next"
|
||||
"libs/ng-i18next/provider"
|
||||
"libs/ng-i18next/directive/directive"
|
||||
"libs/ng-i18next/filter/filter"
|
||||
], () ->
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
App.factory "queuedHttp", ["$http", "$q", ($http, $q) ->
|
||||
App.factory "queuedHttp", ($http, $q) ->
|
||||
pendingRequests = []
|
||||
inflight = false
|
||||
|
||||
|
@ -48,8 +48,6 @@ define [
|
|||
|
||||
return queuedHttp
|
||||
|
||||
]
|
||||
|
||||
App.controller "ProjectPageController", ($scope, $modal, $q, $window, queuedHttp, event_tracking, $timeout) ->
|
||||
$scope.projects = window.data.projects
|
||||
$scope.tags = window.data.tags
|
||||
|
|
20
services/web/public/coffee/utils/i18nextProvider.coffee
Normal file
20
services/web/public/coffee/utils/i18nextProvider.coffee
Normal file
|
@ -0,0 +1,20 @@
|
|||
define [
|
||||
|
||||
], () ->
|
||||
|
||||
|
||||
console.log "hello", angular.module('jm.i18next')
|
||||
angular.module('jm.i18next').config ($i18nextProvider)->
|
||||
console.log "hello 222"
|
||||
$i18nextProvider.options = {
|
||||
lng: 'en-GB',
|
||||
useCookie: false,
|
||||
useLocalStorage: false,
|
||||
fallbackLng: 'dev',
|
||||
resGetPath: '../locales/__lng__/__ns__.json',
|
||||
defaultLoadingValue: '' # ng-i18next option, *NOT* directly supported by i18next
|
||||
}
|
||||
console.log "SUP"
|
||||
console.log $i18nextProvider
|
||||
|
||||
|
Loading…
Reference in a new issue