CivicStack / civicstack

A repository for open source civic tools from many countries and organizations
Other
37 stars 6 forks source link

A translation for Brazilian Portuguese #79

Open augusto-herrmann opened 7 years ago

augusto-herrmann commented 7 years ago

I hope I have changed all the necessary files for it to work.

I have tried but failed to get the project running locally for testing.

gvilarino commented 7 years ago

Care to take a look @jfresco ?

augusto-herrmann commented 7 years ago

I would test it myself, but when trying to run the app I get the following error:

$ sudo docker-compose up
WARNING: The PWD variable is not set. Defaulting to a blank string.
Building app
Step 1 : FROM node:argon
 ---> efc811692903
Step 2 : MAINTAINER Matías Lescano <matias@democraciaenred.org>
 ---> Using cache
 ---> 81399ea61264
Step 3 : RUN apt-get update &&   apt-get install -y libkrb5-dev &&   npm config set python python2.7
 ---> Using cache
 ---> fe83bac3ed13
Step 4 : COPY package.json /usr/src/
 ---> Using cache
 ---> 0cd251d4dd49
Step 5 : WORKDIR /usr/src
 ---> Using cache
 ---> 7f82b9438e34
Step 6 : RUN npm install --quiet --unsafe-perm
 ---> Running in 05894bc069eb
npm WARN package.json civic-stack@1.1.0 No README data

(other WARNINGS edited for brevity)

npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror git://github.com/timaschew/cogent.git /root/.npm/_git-remotes/git-github-com-timaschew-cogent-git-7d2efc1e: Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-timaschew-cogent-git-7d2efc1e'...
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror git://github.com/timaschew/cogent.git /root/.npm/_git-remotes/git-github-com-timaschew-cogent-git-7d2efc1e: fatal: unable to connect to github.com:
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror git://github.com/timaschew/cogent.git /root/.npm/_git-remotes/git-github-com-timaschew-cogent-git-7d2efc1e: github.com[0: 192.30.253.112]: errno=Connection timed out
npm ERR! git clone --template=/root/.npm/_git-remotes/_templates --mirror git://github.com/timaschew/cogent.git /root/.npm/_git-remotes/git-github-com-timaschew-cogent-git-7d2efc1e: github.com[1: 192.30.253.113]: errno=Connection timed out
npm ERR! Linux 4.10.0-30-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--quiet" "--unsafe-perm"
npm ERR! node v4.8.4
npm ERR! npm  v2.15.11
npm ERR! code 128

npm ERR! Command failed: git clone --template=/root/.npm/_git-remotes/_templates --mirror git://github.com/timaschew/cogent.git /root/.npm/_git-remotes/git-github-com-timaschew-cogent-git-7d2efc1e
npm ERR! Cloning into bare repository '/root/.npm/_git-remotes/git-github-com-timaschew-cogent-git-7d2efc1e'...
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 192.30.253.112]: errno=Connection timed out
npm ERR! github.com[1: 192.30.253.113]: errno=Connection timed out
npm ERR! 
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/npm-debug.log
ERROR: Service 'app' failed to build: The command '/bin/sh -c npm install --quiet --unsafe-perm' returned a non-zero code: 1

Apparently the container can't find Github.com for some reason.

The problem also happens with the base unaltered code, cloned from the repository. I'm a noob in Docker, so it may be my own fault I can't run the app.

gvilarino commented 7 years ago

@augusto-herrmann it seems you're working on Windows. Windows development is not supported, although mainly I see two things you should look at:

  1. either set a PWD env var to the process or overwrite the docker-compose.yml in that part so it works properly with your path
  2. git clones are failing, maybe you're in a network that blocks SSH traffic. Attempt those clones manually in your dev box to see what happens.
augusto-herrmann commented 7 years ago

Thanks for the tips, @gvilarino.

I actually am working on Ubuntu 16.04, not Windows. Setting and env var did get rid of the first warning and timeouts, but then it just hangs after the warnings about Kerberos, even if I run docker-compose with the -d flag.

$ sudo PWD=~/civicstack docker-compose up -d
Building app
Step 1 : FROM node:argon
 ---> efc811692903
Step 2 : MAINTAINER Matías Lescano <matias@democraciaenred.org>
 ---> Using cache
 ---> 81399ea61264
Step 3 : RUN apt-get update &&   apt-get install -y libkrb5-dev &&   npm config set python python2.7
 ---> Using cache
 ---> fe83bac3ed13
Step 4 : COPY package.json /usr/src/
 ---> Using cache
 ---> 0cd251d4dd49
Step 5 : WORKDIR /usr/src
 ---> Using cache
 ---> 7f82b9438e34
Step 6 : RUN npm install --quiet --unsafe-perm
 ---> Running in 218ec1fb046a
npm WARN package.json civic-stack@1.1.0 No README data
npm WARN deprecated jade@1.7.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated crypto@0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
npm WARN engine open-graph-scraper@2.5.4: wanted: {"node":">=6.0"} (current: {"node":"4.8.4","npm":"2.15.11"})
npm WARN deprecated mongodb@2.0.55: Please upgrade to 2.2.19 or higher
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated native-or-bluebird@1.2.0: 'native-or-bluebird' is deprecated. Please use 'any-promise' instead.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated mongodb@1.4.31: Please upgrade to 2.2.19 or higher
npm WARN peerDependencies The peer dependency kerberos@~0.0 included from mongodb-core will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.

> kerberos@0.0.9 install /usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory '/usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
kerberos.target.mk:100: recipe for target 'Release/obj.target/kerberos/lib/kerberos.o' failed
make: Leaving directory '/usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'

> bson@0.2.22 install /usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory '/usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
  CXX(target) Release/obj.target/bson/ext/bson.o
bson.target.mk:94: recipe for target 'Release/obj.target/bson/ext/bson.o' failed
make: Leaving directory '/usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'

> kerberos@0.0.23 install /usr/src/node_modules/connect-mongo/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

make: Entering directory '/usr/src/node_modules/connect-mongo/node_modules/mongodb/node_modules/kerberos/build'
  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:36:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic push
 ^
../lib/kerberosgss.c:37:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 ^
../lib/kerberosgss.c: In function 'authenticate_gss_client_wrap':
../lib/kerberosgss.c:446:19: warning: variable 'server_conf_flags' set but not used [-Wunused-but-set-variable]
   char buf[4096], server_conf_flags;
                   ^
../lib/kerberosgss.c: At top level:
../lib/kerberosgss.c:1236:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic pop
 ^
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/obj.target/kerberos.node
  COPY Release/kerberos.node
make: Leaving directory '/usr/src/node_modules/connect-mongo/node_modules/mongodb/node_modules/kerberos/build'

While it is running, I get no response when I access localhost:3000 or 127.0.0.1:3000.

BTW, you have done a nice introduction to docker with your docker-workshop. I've just followed it.

augusto-herrmann commented 7 years ago

Actually, after a while waiting for docker-compose to build, I've got those git clone timeouts again. Oddly, outside of Docker git clone and other SSH operations do work normally.

augusto-herrmann commented 7 years ago

I think I give up trying to run the app for testing. Regardless, it should be simple enough for you guys to run it and see if it works. I do not expect there to be any problems with it.

augusto-herrmann commented 6 years ago

@gvilarino, it turns out that there is no problem with SSH traffic in my network at all.

There are three protocols git can use, git, ssh and https. Unfortunately, my network blocks only git, but ssh and https do work. I tried changing package.json to use https instead of git, but in result I get the same error.

It turns out one of the dependencies (I do not know which one) depends on the /timaschew/cogent package, but declares this dependency using the git protocol. I don't see any obvious way to override that and make it use ssh or https instead.

Any ideas?

gvilarino commented 6 years ago

@augusto-herrmann sadly, there's no way for us to override that since it's an issue of the package itself. The official way to support more than one protocol for a git dependency is described in the official npm documentation. I guess you could open a PR in their repo with that upgrade, linking to this issue.

Also, thanks for following the docker workshop and your kind words <3

jfresco commented 6 years ago

Hi @augusto-herrmann! Amazing job with the translations, thank you very much 👏

It seems that you're missing some UI wirings in order to make the app to switch to Portuguese. For example, there is a menu in the sidebar in which you can choose the language, and Portuguese is missing there:

image

Do you think you can set up your environment to complete that task? Please let us know.

augusto-herrmann commented 6 years ago

@gvilarino, the package which is originating the problem is not a direct dependency defined in packages.json. It is further down in the dependency tree. The error message I already pasted above does not include enough information to find out. Do you know how to debug the dependency tree to find out which packages are requiring timaschew/cogent?

Thanks, @jfresco! I have now noticed other places where I needed to add the language as well. I hope that's all of them, as I still couldn't solve the problem preventing me to run the app and see myself.

augusto-herrmann commented 5 years ago

A couple of years later, I tried to run the application on another network. Civic Stack continues to fail to build, but now for an entirely new reason:

$ docker-compose up -d
Building app
Step 1/8 : FROM node:argon
 ---> ef4b194d8fcf
Step 2/8 : MAINTAINER Matías Lescano <matias@democraciaenred.org>
 ---> Using cache
 ---> f1e3d6425a32
Step 3/8 : RUN apt-get update &&   apt-get install -y libkrb5-dev &&   npm config set python python2.7
 ---> Running in 41ad0dd1fa28
Ign http://deb.debian.org jessie InRelease
Get:1 http://deb.debian.org jessie-updates InRelease [7340 B]
Get:2 http://deb.debian.org jessie Release.gpg [2420 B]
Get:3 http://deb.debian.org jessie Release [148 kB]
Get:4 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Err http://security.debian.org jessie/updates InRelease

Err http://security.debian.org jessie/updates Release.gpg
  Unable to connect to security.debian.org:http:
Fetched 9256 kB in 2min 0s (77.1 kB/s)
Reading package lists...
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/InRelease  Unable to find expected entry 'main/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)

W: Failed to fetch http://security.debian.org/debian-security/dists/jessie/updates/InRelease  

W: Failed to fetch http://security.debian.org/debian-security/dists/jessie/updates/Release.gpg  Unable to connect to security.debian.org:http:

W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
libkrb5-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 46 not upgraded.
Removing intermediate container 41ad0dd1fa28
 ---> dd4af144223a
Step 4/8 : COPY package.json /usr/src/
 ---> 5f9345592d76
Step 5/8 : WORKDIR /usr/src
 ---> Running in c1c5c3b3632c
Removing intermediate container c1c5c3b3632c
 ---> af6dc6c5166f
Step 6/8 : RUN npm install --quiet --unsafe-perm
 ---> Running in cbc1cca862ee
npm WARN package.json civic-stack@1.1.0 No README data
npm WARN deprecated crypto@0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
npm WARN deprecated jade@1.7.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN engine open-graph-scraper@2.5.5: wanted: {"node":">=6.0"} (current: {"node":"4.9.1","npm":"2.15.11"})
npm WARN deprecated mongodb@2.0.55: Please upgrade to 2.2.19 or higher
npm WARN deprecated graceful-fs@2.0.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer
npm WARN deprecated constantinople@2.0.1: Please update to at least constantinople 3.1.1
npm WARN deprecated native-or-bluebird@1.2.0: 'native-or-bluebird' is deprecated. Please use 'any-promise' instead.
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated mongodb@1.4.31: Please upgrade to 2.2.19 or higher
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN engine readable-stream@3.4.0: wanted: {"node":">= 6"} (current: {"node":"4.9.1","npm":"2.15.11"})
npm WARN deprecated browserslist@1.3.6: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN peerDependencies The peer dependency kerberos@~0.0 included from mongodb-core will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN engine readable-stream@3.4.0: wanted: {"node":">= 6"} (current: {"node":"4.9.1","npm":"2.15.11"})
npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.

> kerberos@0.0.9 install /usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory '/usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'
  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
kerberos.target.mk:100: recipe for target 'Release/obj.target/kerberos/lib/kerberos.o' failed
make: Leaving directory '/usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos/build'

> bson@0.2.22 install /usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory '/usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'
  CXX(target) Release/obj.target/bson/ext/bson.o
bson.target.mk:94: recipe for target 'Release/obj.target/bson/ext/bson.o' failed
make: Leaving directory '/usr/src/node_modules/mongoose/node_modules/mongodb/node_modules/bson/build'

> kerberos@0.0.24 install /usr/src/node_modules/connect-mongo/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

make: Entering directory '/usr/src/node_modules/connect-mongo/node_modules/mongodb/node_modules/kerberos/build'
  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
../lib/kerberos.cc: In static member function 'static void Kerberos::After(uv_work_t*)':
../lib/kerberos.cc:948:50: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated (declared at ../node_modules/nan/nan.h:1618) [-Wdeprecated-declarations]
     worker->callback->Call(ARRAY_SIZE(info), info);
                                                  ^
../lib/kerberos.cc:972:50: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated (declared at ../node_modules/nan/nan.h:1618) [-Wdeprecated-declarations]
     worker->callback->Call(ARRAY_SIZE(info), info);
                                                  ^
  CXX(target) Release/obj.target/kerberos/lib/worker.o
  CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:36:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic push
 ^
../lib/kerberosgss.c:37:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 ^
../lib/kerberosgss.c: In function 'authenticate_gss_client_wrap':
../lib/kerberosgss.c:446:19: warning: variable 'server_conf_flags' set but not used [-Wunused-but-set-variable]
   char buf[4096], server_conf_flags;
                   ^
../lib/kerberosgss.c: At top level:
../lib/kerberosgss.c:1236:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
 #pragma clang diagnostic pop
 ^
  CC(target) Release/obj.target/kerberos/lib/base64.o
  CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
  SOLINK_MODULE(target) Release/obj.target/kerberos.node
  COPY Release/kerberos.node
make: Leaving directory '/usr/src/node_modules/connect-mongo/node_modules/mongodb/node_modules/kerberos/build'
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.

> core-js@2.6.9 postinstall /usr/src/node_modules/xo/node_modules/eslint-plugin-ava/node_modules/espurify/node_modules/core-js
> node scripts/postinstall || echo "ignore"

> core-js@2.6.9 postinstall /usr/src/node_modules/xo/node_modules/babel-eslint/node_modules/babel-types/node_modules/babel-runtime/node_modules/core-js
> node scripts/postinstall || echo "ignore"

> core-js@2.6.9 postinstall /usr/src/node_modules/xo/node_modules/babel-eslint/node_modules/babel-traverse/node_modules/babel-runtime/node_modules/core-js
> node scripts/postinstall || echo "ignore"

> civic-stack@1.1.0 postinstall /usr/src
> node ./bin/civicstack-install --config && node ./bin/civicstack-config && node ./bin/civicstack-build

module.js:327
    throw err;
    ^

Error: Cannot find module '/usr/src/bin/civicstack-install'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:140:18)
    at node.js:1043:3

npm ERR! Linux 4.15.0-51-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--quiet" "--unsafe-perm"
npm ERR! node v4.9.1
npm ERR! npm  v2.15.11
npm ERR! code ELIFECYCLE
npm ERR! civic-stack@1.1.0 postinstall: `node ./bin/civicstack-install --config && node ./bin/civicstack-config && node ./bin/civicstack-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the civic-stack@1.1.0 postinstall script 'node ./bin/civicstack-install --config && node ./bin/civicstack-config && node ./bin/civicstack-build'.
npm ERR! This is most likely a problem with the civic-stack package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./bin/civicstack-install --config && node ./bin/civicstack-config && node ./bin/civicstack-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs civic-stack
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls civic-stack
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/npm-debug.log
ERROR: Service 'app' failed to build: The command '/bin/sh -c npm install --quiet --unsafe-perm' returned a non-zero code: 1

It now looks like a problem with the civicstack package itself, as it the following command fails:

node ./bin/civicstack-install --config && node ./bin/civicstack-config && node ./bin/civicstack-build

Anyway, my PR looks fine now, I think. Could any of you (@gvilarino, @jfresco) please test that it works, considering that you are able to get the build running? And hopefully accept and deploy it, so that the Portuguese language becomes available at the site?