Skip to content
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

[translate]Translate the po file into chinese #3717

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9eca92b
[translate] merge translate code
zhouyao1994 Oct 26, 2017
49d170c
[translate] add taiwan-chinese lang
zhouyao1994 Oct 26, 2017
17c4d2e
Fix box_plot NaN issue (#3722)
mistercrunch Oct 26, 2017
b44e4cf
Validate JSON in slice's params on save (#3720)
mistercrunch Oct 26, 2017
af3a124
Add CRUD action to refresh table metadata (#3721)
mistercrunch Oct 26, 2017
523784b
bump react-bootstrap version (#3723)
Oct 27, 2017
35c5e0b
Using indexOf instead of includes for isXAxisString (#3733)
michellethomas Oct 27, 2017
26687a0
Fix 3657 (#3739)
baldoalessandro Oct 30, 2017
68d4879
Escape columns names for time grains - postgres (#3736)
ryanthegiantlion Oct 31, 2017
afd16d5
Fix has_table method (#3741)
mxmzdlv Oct 31, 2017
acaf860
Bumping react-select to rc10 (#3726)
mistercrunch Nov 1, 2017
cd94b93
Consolidate all translation config (#3750)
alanmcruickshank Nov 2, 2017
e810758
fix https://github.com/apache/incubator-superset/pull/3726 (#3751)
Nov 2, 2017
6971895
Add dummy file to fix symlink (#3759)
mistercrunch Nov 2, 2017
56ac82f
add stackoverflow tag (#3764)
dmigo Nov 2, 2017
1fb68c7
docs: reword the FAQ regarding table changes (#3763)
xrmx Nov 2, 2017
cb1eba8
Update to reflect new version of cryptography (#3748)
SpyderRivera Nov 2, 2017
bc89dba
[time table] add tooltip to sparkline (#3767)
williaster Nov 3, 2017
fbf05b2
Fix dashboard export download (#3773)
michellethomas Nov 4, 2017
b698c54
[sql-lab] Fixing Run Query tooltip (#3774)
john-bodley Nov 4, 2017
82b7834
[translate] resovle conflicts only Chinese-simple and Chinese-tw
zhouyao1994 Nov 5, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ If you are proposing a feature:
implement.
- Remember that this is a volunteer-driven project, and that
contributions are welcome :)

### Questions

There is a dedicated [tag](https://stackoverflow.com/questions/tagged/apache-superset) on [stackoverflow](https://stackoverflow.com/). Please use it when asking questions.

## Pull Request Guidelines

Expand Down Expand Up @@ -351,14 +355,15 @@ navigation bar.
}

As per the [Flask AppBuilder documentation] about translation, to create a
new language dictionary, run the following command:
new language dictionary, run the following command (where `es` is replaced with
the language code for your target language):

pybabel init -i ./babel/messages.pot -d superset/translations -l es
pybabel init -i superset/translations/messages.pot -d superset/translations -l es

Then it's a matter of running the statement below to gather all strings that
need translation

fabmanager babel-extract --target superset/translations/ -k _ -k __ -k t -k tn -k tct
fabmanager babel-extract --target superset/translations/ --output superset/translations/messages.pot --config superset/translations/babel.cfg -k _ -k __ -k t -k tn -k tct

You can then translate the strings gathered in files located under
`superset/translation`, where there's one per language. For the translations
Expand All @@ -375,6 +380,11 @@ Execute this command to convert the en PO file into a json file:

po2json -d superset -f jed1.x superset/translations/en/LC_MESSAGES/messages.po superset/translations/en/LC_MESSAGES/messages.json

If you get errors running `po2json`, you might be running the ubuntu package with the same
name rather than the nodejs package (they have a different format for the arguments). You
need to be running the nodejs version, and so if there is a conflict you may need to point
directly at `/usr/local/bin/po2json` rather than just `po2json`.

## Adding new datasources

1. Create Models and Views for the datasource, add them under superset folder, like a new my_models.py
Expand Down
7 changes: 4 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
recursive-include superset/templates *
recursive-include superset/data *
recursive-include superset/migrations *
recursive-include superset/static *
recursive-exclude superset/static/docs *
recursive-exclude superset/static/spec *
recursive-exclude superset/static/assets/node_modules *
recursive-include superset/templates *
recursive-include superset/translations *
recursive-exclude tests *
recursive-include superset/data *
recursive-include superset/migrations *
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ Resources
* [Gitter (live chat) Channel](https://gitter.im/airbnb/superset)
* [Docker image](https://hub.docker.com/r/amancevice/superset/) (community contributed)
* [Slides from Strata (March 2016)](https://drive.google.com/open?id=0B5PVE0gzO81oOVJkdF9aNkJMSmM)
* [Stackoverflow tag](https://stackoverflow.com/questions/tagged/apache-superset)


Contributing
Expand Down
1 change: 1 addition & 0 deletions docs/_build/html/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Folder containing the sphinx-generated documentation
12 changes: 10 additions & 2 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ You can override this path using the ``SUPERSET_HOME`` environment variable.

Another work around is to change where superset stores the sqlite database by adding ``SQLALCHEMY_DATABASE_URI = 'sqlite:////new/location/superset.db'`` in superset_config.py (create the file if needed), then adding the directory where superset_config.py lives to PYTHONPATH environment variable (e.g. ``export PYTHONPATH=/opt/logs/sandbox/airbnb/``).

How do I add new columns to an existing table
---------------------------------------------
What if the table schema changed?
---------------------------------

Table schemas evolve, and Superset needs to reflect that. It's pretty common
in the life cycle of a dashboard to want to add a new dimension or metric.
Expand Down Expand Up @@ -213,3 +213,11 @@ How can I set a default filter on my dashboard?

Easy. Simply apply the filter and save the dashboard while the filter
is active.

How do I get Superset to refresh the schema of my table?
--------------------------------------------------------

When adding columns to a table, you can have Superset detect and merge the
new columns in by using the "Refresh Metadata" action in the
``Source -> Tables`` page. Simply check the box next to the tables
you want the schema refreshed, and click ``Actions -> Refresh Metadata``.
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ that the required dependencies are installed: ::
**OSX**, system python is not recommended. brew's python also ships with pip ::

brew install pkg-config libffi openssl python
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography==1.7.2
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography==1.9

**Windows** isn't officially supported at this point, but if you want to
attempt it, download `get-pip.py <https://bootstrap.pypa.io/get-pip.py>`_, and run ``python get-pip.py`` which may need admin access. Then run the following: ::
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets" : ["airbnb", "env", "react"],
"presets" : ["airbnb"],
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default function RunQueryActionButton(props) {
const runBtnText = props.selectedText ? t('Run Selected Query') : t('Run Query');
const btnStyle = props.selectedText ? 'warning' : 'primary';
const shouldShowStopBtn = ['running', 'pending'].indexOf(props.queryState) > -1;
const asyncToolTip = t('Run query asynchronously');

const commonBtnProps = {
bsSize: 'small',
Expand All @@ -32,7 +31,7 @@ export default function RunQueryActionButton(props) {
{...commonBtnProps}
onClick={() => props.runQuery(false)}
key="run-btn"
tooltip={asyncToolTip}
tooltip={t('Run query synchronously')}
>
<i className="fa fa-refresh" /> {runBtnText}
</Button>
Expand All @@ -43,7 +42,7 @@ export default function RunQueryActionButton(props) {
{...commonBtnProps}
onClick={() => props.runQuery(true)}
key="run-async-btn"
tooltip={asyncToolTip}
tooltip={t('Run query asynchronously')}
>
<i className="fa fa-table" /> {runBtnText}
</Button>
Expand Down
5 changes: 3 additions & 2 deletions superset/assets/javascripts/components/MetricOption.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import InfoTooltipWithTrigger from './InfoTooltipWithTrigger';

const propTypes = {
metric: PropTypes.object.isRequired,
openInNewWindow: PropTypes.bool,
showFormula: PropTypes.bool,
url: PropTypes.string,
};
const defaultProps = {
showFormula: true,
};

export default function MetricOption({ metric, showFormula, url }) {
export default function MetricOption({ metric, openInNewWindow, showFormula, url }) {
const verbose = metric.verbose_name || metric.metric_name;
const link = url ? <a href={url}>{verbose}</a> : verbose;
const link = url ? <a href={url} target={openInNewWindow ? '_blank' : null}>{verbose}</a> : verbose;
return (
<div>
<span className="m-r-5 option-label">{link}</span>
Expand Down
1 change: 0 additions & 1 deletion superset/assets/javascripts/modules/dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export const tickMultiFormat = d3.time.format.multi([
]);
export const formatDate = function (dttm) {
const d = UTC(new Date(dttm));
// d = new Date(d.getTime() - 1 * 60 * 60 * 1000);
return tickMultiFormat(d);
};
export const fDuration = function (t1, t2, f = 'HH:mm:ss.SS') {
Expand Down
8 changes: 3 additions & 5 deletions superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"homepage": "http://superset.apache.org/",
"dependencies": {
"@data-ui/event-flow": "0.0.8",
"@data-ui/sparkline": "0.0.1",
"@data-ui/sparkline": "0.0.47",
"babel-register": "^6.24.1",
"bootstrap": "^3.3.6",
"brace": "^0.10.0",
Expand Down Expand Up @@ -70,7 +70,7 @@
"react-addons-css-transition-group": "^15.6.0",
"react-addons-shallow-compare": "^15.4.2",
"react-alert": "^2.3.0",
"react-bootstrap": "^0.31.2",
"react-bootstrap": "^0.31.5",
"react-bootstrap-table": "^4.0.2",
"react-color": "^2.13.8",
"react-datetime": "2.9.0",
Expand All @@ -80,7 +80,7 @@
"react-map-gl": "^3.0.4",
"react-redux": "^5.0.2",
"react-resizable": "^1.3.3",
"react-select": "1.0.0-rc.3",
"react-select": "1.0.0-rc.10",
"react-select-fast-filter-options": "^0.2.1",
"react-sortable-hoc": "^0.6.7",
"react-split-pane": "^0.1.66",
Expand All @@ -106,8 +106,6 @@
"babel-plugin-css-modules-transform": "^1.1.0",
"babel-polyfill": "^6.23.0",
"babel-preset-airbnb": "^2.1.1",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.11.1",
"chai": "^4.0.2",
"clean-webpack-plugin": "^0.1.16",
"codeclimate-test-reporter": "^0.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,13 @@ describe('MetricOption', () => {
wrapper = shallow(factory(props));
expect(wrapper.find(InfoTooltipWithTrigger)).to.have.length(1);
});
it('sets target="_blank" when openInNewWindow is true', () => {
props.url = 'https://github.com/apache/incubator-superset';
wrapper = shallow(factory(props));
expect(wrapper.find('a').prop('target')).to.equal(null);

props.openInNewWindow = true;
wrapper = shallow(factory(props));
expect(wrapper.find('a').prop('target')).to.equal('_blank');
});
});
100 changes: 7 additions & 93 deletions superset/assets/stylesheets/react-select/select.less
Original file line number Diff line number Diff line change
@@ -1,99 +1,13 @@
// @mistercrunch
@select-primary-color: black;

/**
* React Select
* ============
* Created by Jed Watson and Joss Mackison for KeystoneJS, http://www.keystonejs.com/
* https://twitter.com/jedwatson https://twitter.com/jossmackison https://twitter.com/keystonejs
* MIT License: https://github.com/keystonejs/react-select
*/

// Variables
// ------------------------------

// common
//@select-primary-color: #007eff;

// control options
@select-input-bg: #fff;
@select-input-bg-disabled: #f9f9f9;
@select-input-border-color: #ccc;
@select-input-border-radius: 4px;
@select-input-border-focus: @select-primary-color;
@select-input-border-width: 1px;
@select-input-height: 30px;
@select-input-internal-height: (@select-input-height - (@select-input-border-width * 2));
@select-input-placeholder: #aaa;
@select-text-color: #333;
@select-link-hover-color: @select-input-border-focus;

@select-padding-vertical: 8px;
@select-padding-horizontal: 10px;

// menu options
@select-menu-zindex: 1;
@select-menu-max-height: 200px;

@select-option-color: lighten(@select-text-color, 20%);
@select-option-bg: @select-input-bg;
@select-option-focused-color: @select-text-color;
@select-option-focused-bg: fade(@select-primary-color, 8%);
@select-option-focused-bg-fb: mix(@select-primary-color, @select-option-bg, 8%); // Fallback color for IE 8
@select-option-selected-color: @select-text-color;
@select-option-selected-bg: fade(@select-primary-color, 4%);
@select-option-selected-bg-fb: mix(@select-primary-color, @select-option-bg, 4%); // Fallback color for IE 8
@select-option-disabled-color: lighten(@select-text-color, 60%);

@select-noresults-color: lighten(@select-text-color, 40%);

// clear "x" button
@select-clear-size: floor((@select-input-height / 2));
@select-clear-color: #999;
@select-clear-hover-color: #D0021B; // red
@select-clear-width: (@select-input-internal-height / 2);

// arrow indicator
@select-arrow-color: #999;
@select-arrow-color-hover: #666;
@select-arrow-width: 5px;

// loading indicator
@select-loading-size: 16px;
@select-loading-color: @select-text-color;
@select-loading-color-bg: @select-input-border-color;

// multi-select item
@select-item-font-size: .9em;

@select-item-bg: fade(@select-primary-color, 8%);
@select-item-bg-fb: mix(@select-primary-color, @select-input-bg, 8%); // Fallback color for IE 8
@select-item-color: @select-primary-color;
@select-item-border-color: fade(@select-primary-color, 24%);
@select-item-border-color-fb: mix(@select-primary-color, @select-input-bg, 24%); // Fallback color for IE 8
@select-item-hover-color: darken(@select-item-color, 5%);
@select-item-hover-bg: darken(@select-item-bg, 5%);
@select-item-hover-bg-fb: mix(darken(@select-primary-color, 5%), @select-item-bg-fb, 8%); // Fallback color for IE 8
@select-item-disabled-color: #333;
@select-item-disabled-bg: #fcfcfc;
@select-item-disabled-border-color: darken(@select-item-disabled-bg, 10%);

@select-item-border-radius: 2px;
@select-item-gutter: 5px;

@select-item-padding-horizontal: 5px;
@select-item-padding-vertical: 2px;
@import "~react-select/less/select.less";
@select-primary-color: black;

// imports
// @mistercrunch: these were altered to point to react-select/less
@import "../../node_modules/react-select/less/control.less";
@import "../../node_modules/react-select/less/menu.less";
@import "../../node_modules/react-select/less/mixins.less";
@import "../../node_modules/react-select/less/multi.less";
@import "../../node_modules/react-select/less/spinner.less";
@import "~react-select/less/control.less";
@import "~react-select/less/menu.less";
@import "~react-select/less/mixins.less";
@import "~react-select/less/multi.less";
@import "~react-select/less/spinner.less";

// importing css from "../../node_modules/react-virtualized-select/styles.css";
// so the background color of a selected option matches the other selects
.VirtualSelectGrid {
z-index: 1;
}
Expand Down
7 changes: 5 additions & 2 deletions superset/assets/stylesheets/superset.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ input.form-control {
background-color: white;
}

input.form-control.input-sm {
height: 36px;
}

.chart-header a.danger {
color: red;
}
Expand Down Expand Up @@ -346,11 +350,10 @@ iframe {
.Select-multi-value-wrapper {
display: flex;
flex-wrap: wrap;
padding-bottom: 3px;
}

.Select-value {
line-height: 1.2;
height: 23px;
}

.Select-input > input {
Expand Down
7 changes: 3 additions & 4 deletions superset/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,7 @@ function nvd3Vis(slice, payload) {
case 'box_plot':
colorKey = 'label';
chart = nv.models.boxPlotChart();
chart.x(function (d) {
return d.label;
});
chart.x(d => d.label);
chart.staggerLabels(true);
chart.maxBoxWidth(75); // prevent boxes from being incredibly wide
break;
Expand Down Expand Up @@ -353,7 +351,8 @@ function nvd3Vis(slice, payload) {
chart.x2Axis.tickFormat(xAxisFormatter);
height += 30;
}
if (vizType !== 'dist_bar' && chart.xAxis && chart.xAxis.tickFormat) {
const isXAxisString = ['dist_bar', 'box_plot'].indexOf(vizType) >= 0;
if (!isXAxisString && chart.xAxis && chart.xAxis.tickFormat) {
chart.xAxis.tickFormat(xAxisFormatter);
}

Expand Down
Loading