-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Improved localization through google getMsg() #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0d3d766
to
10247d7
Compare
Current coverage is 95.22%
@@ master #725 diff @@
==========================================
Files 175 175
Lines 1360 1361 +1
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 1289 1296 +7
+ Misses 71 65 -6
Partials 0 0
|
@floreks @maciaszczykm Can you have a look at the travis build? I see some strange error during the integration tests, but the build turns out green? Is this normal? |
It is normal. They are turned off, but still executed. |
Yes, looks way better now :) Reviewed 2 of 19 files at r1. a discussion (no related file): a discussion (no related file): src/app/backend/handler/localehandler.go, line 47 [r1] (raw file):
Why? src/app/backend/handler/localehandler.go, line 86 [r1] (raw file):
How about loading the configuration at server startup? Currently you load the file on every request to index.html, which is suboptimal. When the backend loads all configuration at startup you can be sure that once it starts correctly, it'll function correctly. This is a huge benefit in a production system. Here, when you do config loading at runtime, everything may break at any time. What do you think? cc @floreks Comments from Reviewable |
Why |
I overlooked the exact position of the binary. Thanks, I'll place it into the |
Review status: 2 of 19 files reviewed at latest revision, 13 unresolved discussions. a discussion (no related file): build/build.js, line 26 [r1] (raw file):
Name it gulpRevAll. This is how other gulp plugins are called most often :) build/build.js, line 126 [r1] (raw file):
Why do you remove it from here? Shouldn't this just work? build/build.js, line 203 [r1] (raw file):
Can you not generate gulp.tasks and use plain functions/streams instead? Additional thing (apart from mentioned by me in the other comment) is that gulp.tasks are for organizing dependencies. And the task localize:en cannot has no formal dependencies, yet it requires some prerequisites. cc @floreks build/build.js, line 230 [r1] (raw file):
I see a copy &paste from distFiles function. Can you extract this? build/build.js, line 245 [r1] (raw file):
Same copy & paste :) build/multidest.js, line 21 [r1] (raw file):
Say that this is optional with build/script.js, line 120 [r1] (raw file):
Hmm... I this looks like a wrong pattern. Basically, you're creating gulp.tasks on the fly. So I see a task in console "scripts:en" but I cannot run it with docs/design/i18n.md, line 18 [r1] (raw file):
How about we have a minimalistic folder structure where only files that need localization are copied? I.e., dist/amd64/public/ and here index.en.html and in static app.en.js plus other files untouched? This would unbloat our binary where we copy everything N times for all languages. Is this hard to implement? Comments from Reviewable |
Review status: 2 of 19 files reviewed at latest revision, 13 unresolved discussions. build/build.js, line 126 [r1] (raw file):
|
Review status: 2 of 19 files reviewed at latest revision, 18 unresolved discussions. build/build.js, line 126 [r1] (raw file):
|
10247d7
to
b4deeed
Compare
Review status: 2 of 20 files reviewed at latest revision, 14 unresolved discussions. build/build.js, line 26 [r1] (raw file):
|
@bryk I'm back at office, just had some time to pick this up again :) PTAL now, I moved the configuration of the LocaleHandler in the very beginning. I'll see if I could make the folder structure "minimalistic" as you noted in one of your previous comments. Please check if you see any more issues. Next step would now be to replace all text across dashboard with |
746ba32
to
1d0441a
Compare
Please create a separate issue to talk about this.
Please create a separate issue and separate PR for this. This PR is good for now :) Reviewed 9 of 19 files at r1, 3 of 7 files at r3, 1 of 2 files at r4. a discussion (no related file):
a discussion (no related file): package.json, line 45 [r4] (raw file):
Do we need this dependency anymore? build/build.js, line 26 [r1] (raw file):
|
Review status: 15 of 20 files reviewed at latest revision, 6 unresolved discussions. a discussion (no related file):
|
1d0441a
to
672b085
Compare
Review status: 15 of 20 files reviewed at latest revision, 6 unresolved discussions. a discussion (no related file):
|
Review status: 15 of 20 files reviewed at latest revision, 6 unresolved discussions. package.json, line 45 [r4] (raw file):
|
Review status: 15 of 20 files reviewed at latest revision, 6 unresolved discussions. a discussion (no related file):
|
Reviewed 1 of 19 files at r1, 1 of 2 files at r4, 1 of 3 files at r5. a discussion (no related file):
Can you just copy the locale file to serve dir? a discussion (no related file):
|
Review status: 18 of 20 files reviewed at latest revision, 4 unresolved discussions. a discussion (no related file):
|
Review status: 18 of 20 files reviewed at latest revision, 4 unresolved discussions. a discussion (no related file):
|
672b085
to
dd6b5a6
Compare
Review status: 18 of 21 files reviewed at latest revision, 5 unresolved discussions. build/serve.js, line 166 [r6] (raw file):
Is it okay like this? Called on Comments from Reviewable |
Review status: 18 of 21 files reviewed at latest revision, 5 unresolved discussions. build/serve.js, line 166 [r6] (raw file):
|
22c5dfe
to
9d5f80e
Compare
@bryk PTAL, this is ready for a final review :) |
9d5f80e
to
c31c5c9
Compare
Thanks a lot! This was long but we're finally here. Last comment, this time for real.
|
Review status: all files reviewed at latest revision, 4 unresolved discussions. i18n/messages-ja.xtb, line 4 [r7] (raw file):
|
c31c5c9
to
f398a41
Compare
Review status: 17 of 21 files reviewed at latest revision, 4 unresolved discussions. i18n/messages-ja.xtb, line 4 [r7] (raw file):
|
Reviewed 4 of 4 files at r8. Comments from Reviewable |
:) Will merge soon.
|
This is an improved version of my getMsg() proposal for the localization in dashboard. It differs from #528 in the following aspects:
build-frontend
was called once for each locale, which is an overkill. Nowbuild-frontend
is called only once and the result is thenmultiDest
-ed into all the arch x locale directories.app.js
files (instead of calling the wholebuild-frontend
like before).app.js
files are built viagulp scripts:prod
into separate directories under.tmp
. NOTE: I could not make this step parallel, becausegulp-closure-compiler
cannot be run in parallel. I know the exact point of failure, it is here. Basically its an issue with the temporary file used to hold the output of the closure-compiler.merge-stream
andasync
like before, I now only usemultiDest
and standard gulp-tasks defined on the fly, which I execute withrun-sequence
. That way we have the benefit of no third party dependencies and we can directly see the actual tasks being executed in the console (with the nice gulp coloring, etc.).LocaleHandler
backend component now first compares theAccept Language
header to a list of predefined locales before serving anything (security measure).@bryk PTAL, I tried to improve upon all of your remarks. Do you think the LocaleHandler is now secure enough? What do we do with the
scripts:prod
task, I cannot run it in parallel because of thegulp-closure-compiler
, but there is no way around calling it once for each locale.This change is