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

[core] Add localization #18219

Merged

Conversation

@mui-pr-bot
Copy link

mui-pr-bot commented Nov 5, 2019

@material-ui/core: parsed: +0.09% , gzip: +0.11%

Details of bundle changes.

Comparing: 64ae0c6...da38bff

bundle Size Change Size Gzip Change Gzip
docs.main ▲ +2.7 kB (+0.44% ) 609 kB ▲ +1.07 kB (+0.55% ) 194 kB
@material-ui/core ▲ +315 B (+0.09% ) 351 kB ▲ +106 B (+0.11% ) 96 kB
TablePagination ▲ +315 B (+0.23% ) 139 kB ▲ +101 B (+0.25% ) 40.7 kB
@material-ui/core[umd] ▲ +295 B (+0.10% ) 310 kB ▲ +107 B (+0.12% ) 89.3 kB
@material-ui/lab ▲ +197 B (+0.11% ) 172 kB ▲ +93 B (+0.18% ) 51.7 kB
Autocomplete ▲ +197 B (+0.16% ) 126 kB ▲ +75 B (+0.19% ) 39.9 kB
StepButton ▲ +93 B (+0.12% ) 80.9 kB ▲ +49 B (+0.19% ) 25.4 kB
Breadcrumbs ▲ +93 B (+0.14% ) 66.6 kB ▲ +48 B (+0.23% ) 20.9 kB
ToggleButton ▲ +93 B (+0.12% ) 74.7 kB ▲ +47 B (+0.20% ) 23.6 kB
ButtonGroup ▲ +93 B (+0.12% ) 80.6 kB ▲ +46 B (+0.19% ) 24.7 kB
SpeedDialAction ▲ +93 B (+0.08% ) 115 kB ▲ +46 B (+0.13% ) 36.4 kB
TableCell ▲ +93 B (+0.15% ) 62.7 kB ▲ +46 B (+0.23% ) 19.7 kB
ListItem ▲ +93 B (+0.12% ) 75.7 kB ▲ +45 B (+0.19% ) 23.6 kB
MobileStepper ▲ +93 B (+0.14% ) 66.3 kB ▲ +45 B (+0.22% ) 20.7 kB
ButtonBase ▲ +93 B (+0.13% ) 72.5 kB ▲ +44 B (+0.19% ) 22.7 kB
MenuItem ▲ +93 B (+0.12% ) 76.7 kB ▲ +44 B (+0.18% ) 23.9 kB
Grid ▲ +93 B (+0.15% ) 63.7 kB ▲ +43 B (+0.22% ) 20 kB
StepLabel ▲ +93 B (+0.14% ) 67.2 kB ▲ +43 B (+0.20% ) 21.1 kB
TextField ▲ +93 B (+0.08% ) 121 kB ▲ +43 B (+0.12% ) 35.5 kB
Avatar ▲ +93 B (+0.15% ) 61.4 kB ▲ +42 B (+0.22% ) 19.3 kB
BottomNavigationAction ▲ +93 B (+0.13% ) 74.1 kB ▲ +42 B (+0.18% ) 23.4 kB
Card ▲ +93 B (+0.15% ) 61.4 kB ▲ +42 B (+0.22% ) 19.2 kB
Fab ▲ +93 B (+0.12% ) 75.4 kB ▲ +42 B (+0.18% ) 23.4 kB
FormHelperText ▲ +93 B (+0.15% ) 61.9 kB ▲ +42 B (+0.22% ) 19.4 kB
InputLabel ▲ +93 B (+0.15% ) 63.9 kB ▲ +42 B (+0.21% ) 19.9 kB
Paper ▲ +93 B (+0.15% ) 60.9 kB ▲ +42 B (+0.22% ) 18.9 kB
Select ▲ +93 B (+0.08% ) 113 kB ▲ +42 B (+0.13% ) 33.5 kB
SnackbarContent ▲ +93 B (+0.14% ) 64.3 kB ▲ +42 B (+0.21% ) 20.2 kB
TableSortLabel ▲ +93 B (+0.12% ) 75.9 kB ▲ +42 B (+0.18% ) 24 kB
Box ▲ +93 B (+0.13% ) 69.4 kB ▲ +41 B (+0.20% ) 21 kB
Button ▲ +93 B (+0.12% ) 78 kB ▲ +41 B (+0.17% ) 23.9 kB
CardActionArea ▲ +93 B (+0.13% ) 73.6 kB ▲ +41 B (+0.18% ) 23.2 kB
CssBaseline ▲ +93 B (+0.17% ) 56.2 kB ▲ +41 B (+0.23% ) 17.6 kB
IconButton ▲ +93 B (+0.12% ) 74.7 kB ▲ +41 B (+0.18% ) 23.3 kB
ListSubheader ▲ +93 B (+0.15% ) 61.4 kB ▲ +41 B (+0.21% ) 19.3 kB
Switch ▲ +93 B (+0.12% ) 79.7 kB ▲ +41 B (+0.17% ) 24.8 kB
Tab ▲ +93 B (+0.12% ) 74.9 kB ▲ +41 B (+0.17% ) 23.7 kB
Badge ▲ +93 B (+0.15% ) 64 kB ▲ +40 B (+0.20% ) 19.8 kB
Collapse ▲ +93 B (+0.14% ) 66.5 kB ▲ +40 B (+0.20% ) 20.5 kB
Input ▲ +93 B (+0.13% ) 71.1 kB ▲ +40 B (+0.18% ) 22.1 kB
ExpansionPanel ▲ +93 B (+0.13% ) 69.8 kB ▲ +39 B (+0.18% ) 21.8 kB
FilledInput ▲ +93 B (+0.13% ) 72.2 kB ▲ +39 B (+0.17% ) 22.4 kB
Popover ▲ +93 B (+0.11% ) 81.2 kB ▲ +39 B (+0.16% ) 25 kB
Table ▲ +93 B (+0.15% ) 61.2 kB ▲ +39 B (+0.20% ) 19.2 kB
Tabs ▲ +93 B (+0.11% ) 84 kB ▲ +39 B (+0.15% ) 26.8 kB
AppBar ▲ +93 B (+0.15% ) 62.4 kB ▲ +38 B (+0.19% ) 19.6 kB
BottomNavigation ▲ +93 B (+0.15% ) 61 kB ▲ +38 B (+0.20% ) 19.1 kB
InputBase ▲ +93 B (+0.13% ) 69.2 kB ▲ +38 B (+0.18% ) 21.7 kB
List ▲ +93 B (+0.15% ) 61 kB ▲ +38 B (+0.20% ) 19 kB
OutlinedInput ▲ +93 B (+0.13% ) 72.7 kB ▲ +38 B (+0.17% ) 22.5 kB
ToggleButtonGroup ▲ +93 B (+0.15% ) 61.8 kB ▲ +38 B (+0.20% ) 19.4 kB
Typography ▲ +93 B (+0.15% ) 62.3 kB ▲ +38 B (+0.20% ) 19.4 kB
Chip ▲ +93 B (+0.11% ) 81.1 kB ▲ +37 B (+0.15% ) 24.8 kB
ExpansionPanelSummary ▲ +93 B (+0.12% ) 76.7 kB ▲ +37 B (+0.15% ) 24.1 kB
MenuList ▲ +93 B (+0.14% ) 64.6 kB ▲ +37 B (+0.18% ) 20.2 kB
StepConnector ▲ +93 B (+0.15% ) 61.3 kB ▲ +37 B (+0.19% ) 19.3 kB
SvgIcon ▲ +93 B (+0.15% ) 61.7 kB ▲ +37 B (+0.19% ) 19.2 kB
Backdrop ▲ +93 B (+0.14% ) 66.4 kB ▲ +36 B (+0.18% ) 20.5 kB
Checkbox ▲ +93 B (+0.12% ) 80.4 kB ▲ +36 B (+0.14% ) 25.2 kB
Dialog ▲ +93 B (+0.11% ) 81.1 kB ▲ +36 B (+0.14% ) 25.2 kB
FormGroup ▲ +93 B (+0.15% ) 60.6 kB ▲ +36 B (+0.19% ) 19 kB
FormLabel ▲ +93 B (+0.15% ) 62.1 kB ▲ +36 B (+0.19% ) 19.2 kB
InputAdornment ▲ +93 B (+0.15% ) 63.7 kB ▲ +36 B (+0.18% ) 20.1 kB
Radio ▲ +93 B (+0.11% ) 81.2 kB ▲ +36 B (+0.14% ) 25.5 kB
SpeedDial ▲ +93 B (+0.11% ) 84.6 kB ▲ +36 B (+0.14% ) 26.6 kB
StepIcon ▲ +93 B (+0.15% ) 63.3 kB ▲ +36 B (+0.18% ) 19.7 kB
Toolbar ▲ +93 B (+0.15% ) 61 kB ▲ +36 B (+0.19% ) 19.1 kB
FormControl ▲ +93 B (+0.15% ) 63 kB ▲ +35 B (+0.18% ) 19.6 kB
Snackbar ▲ +93 B (+0.12% ) 75.8 kB ▲ +35 B (+0.15% ) 23.6 kB
styles/createMuiTheme ▲ +93 B (+0.61% ) 15.4 kB ▲ +35 B (+0.65% ) 5.43 kB
CardMedia ▲ +93 B (+0.15% ) 61 kB ▲ +34 B (+0.18% ) 19.2 kB
CircularProgress ▲ +93 B (+0.15% ) 62.7 kB ▲ +34 B (+0.17% ) 19.7 kB
DialogTitle ▲ +93 B (+0.15% ) 62.9 kB ▲ +34 B (+0.17% ) 19.8 kB
Drawer ▲ +93 B (+0.11% ) 82.9 kB ▲ +34 B (+0.13% ) 25.7 kB
Fade ▲ +93 B (+0.42% ) 22.2 kB ▲ +34 B (+0.45% ) 7.67 kB
FormControlLabel ▲ +93 B (+0.15% ) 64.1 kB ▲ +34 B (+0.17% ) 20.1 kB
Zoom ▲ +93 B (+0.42% ) 22.3 kB ▲ +34 B (+0.45% ) 7.67 kB
GridListTile ▲ +93 B (+0.15% ) 62.4 kB ▲ +33 B (+0.17% ) 19.5 kB
LinearProgress ▲ +93 B (+0.15% ) 64 kB ▲ +33 B (+0.17% ) 19.9 kB
Slide ▲ +93 B (+0.38% ) 24.3 kB ▲ +33 B (+0.40% ) 8.28 kB
Slider ▲ +93 B (+0.13% ) 74.2 kB ▲ +33 B (+0.14% ) 23.4 kB
TreeView ▲ +93 B (+0.14% ) 65 kB ▲ +33 B (+0.16% ) 20.3 kB
CardActions ▲ +93 B (+0.15% ) 60.7 kB ▲ +32 B (+0.17% ) 19 kB
CardHeader ▲ +93 B (+0.15% ) 63.7 kB ▲ +32 B (+0.16% ) 20 kB
DialogActions ▲ +93 B (+0.15% ) 60.7 kB ▲ +32 B (+0.17% ) 19 kB
DialogContentText ▲ +93 B (+0.15% ) 62.7 kB ▲ +32 B (+0.16% ) 19.7 kB
ExpansionPanelActions ▲ +93 B (+0.15% ) 60.7 kB ▲ +32 B (+0.17% ) 19 kB
ExpansionPanelDetails ▲ +93 B (+0.15% ) 60.6 kB ▲ +32 B (+0.17% ) 18.9 kB
Grow ▲ +93 B (+0.41% ) 22.8 kB ▲ +32 B (+0.41% ) 7.79 kB
Icon ▲ +93 B (+0.15% ) 61.4 kB ▲ +32 B (+0.17% ) 19.2 kB
Link ▲ +93 B (+0.14% ) 65.2 kB ▲ +32 B (+0.16% ) 20.7 kB
ListItemText ▲ +93 B (+0.15% ) 63.6 kB ▲ +32 B (+0.16% ) 20 kB
NativeSelect ▲ +93 B (+0.12% ) 75.4 kB ▲ +32 B (+0.13% ) 23.7 kB
Skeleton ▲ +93 B (+0.15% ) 61.1 kB ▲ +32 B (+0.17% ) 19.2 kB
SpeedDialIcon ▲ +93 B (+0.15% ) 63.2 kB ▲ +32 B (+0.16% ) 19.8 kB
TableBody ▲ +93 B (+0.15% ) 60.7 kB ▲ +32 B (+0.17% ) 19 kB
TableFooter ▲ +93 B (+0.15% ) 60.7 kB ▲ +32 B (+0.17% ) 19 kB
TableHead ▲ +93 B (+0.15% ) 60.7 kB ▲ +32 B (+0.17% ) 19 kB
TableRow ▲ +93 B (+0.15% ) 61.2 kB ▲ +32 B (+0.17% ) 19.2 kB
Tooltip ▲ +93 B (+0.09% ) 99.1 kB ▲ +32 B (+0.10% ) 31.3 kB
CardContent ▲ +93 B (+0.15% ) 60.6 kB ▲ +31 B (+0.16% ) 19 kB
Container ▲ +93 B (+0.15% ) 61.8 kB ▲ +31 B (+0.16% ) 19.3 kB
DialogContent ▲ +93 B (+0.15% ) 60.8 kB ▲ +31 B (+0.16% ) 19.1 kB
GridListTileBar ▲ +93 B (+0.15% ) 61.8 kB ▲ +31 B (+0.16% ) 19.4 kB
Hidden ▲ +93 B (+0.14% ) 64.6 kB ▲ +31 B (+0.15% ) 20.2 kB
ListItemSecondaryAction ▲ +93 B (+0.15% ) 60.6 kB ▲ +31 B (+0.16% ) 19 kB
Menu ▲ +93 B (+0.11% ) 86.8 kB ▲ +31 B (+0.11% ) 27.2 kB
RadioGroup ▲ +93 B (+0.15% ) 61.9 kB ▲ +31 B (+0.16% ) 19.3 kB
Stepper ▲ +93 B (+0.15% ) 63.4 kB ▲ +31 B (+0.16% ) 19.9 kB
Divider ▲ +93 B (+0.15% ) 61.2 kB ▲ +30 B (+0.16% ) 19.2 kB
GridList ▲ +93 B (+0.15% ) 61.1 kB ▲ +30 B (+0.16% ) 19.2 kB
ListItemAvatar ▲ +93 B (+0.15% ) 60.7 kB ▲ +30 B (+0.16% ) 19 kB
ListItemIcon ▲ +93 B (+0.15% ) 60.8 kB ▲ +30 B (+0.16% ) 19 kB
StepContent ▲ +93 B (+0.14% ) 67.6 kB ▲ +30 B (+0.14% ) 21.1 kB
SwipeableDrawer ▲ +93 B (+0.10% ) 90.3 kB ▲ +30 B (+0.11% ) 28 kB
TreeItem ▲ +93 B (+0.13% ) 72.2 kB ▲ +30 B (+0.13% ) 22.7 kB
Step ▲ +93 B (+0.15% ) 61.2 kB ▲ +29 B (+0.15% ) 19.2 kB
Rating ▲ +93 B (+0.14% ) 68.6 kB ▲ +28 B (+0.13% ) 22 kB
@material-ui/styles -- 50.8 kB -- 15.4 kB
@material-ui/system -- 14.8 kB -- 4.06 kB
ClickAwayListener -- 3.87 kB -- 1.56 kB
colorManipulator -- 3.83 kB -- 1.52 kB
docs.landing -- 55.8 kB -- 14.3 kB
Modal -- 14.2 kB -- 4.96 kB
NoSsr -- 2.19 kB -- 1.04 kB
Popper -- 28.5 kB -- 10.2 kB
Portal -- 2.87 kB -- 1.3 kB
RootRef -- 4.43 kB -- 1.67 kB
TextareaAutosize -- 5.06 kB -- 2.11 kB
useAutocomplete -- 12.1 kB -- 4.47 kB
useMediaQuery -- 2.49 kB -- 1.05 kB

Generated by 🚫 dangerJS against da38bff

@soltanloo soltanloo changed the title Add new props to accept custom titles for Autocomplete buttons [Autocomplete] Add new props to accept custom titles for Autocomplete buttons Nov 5, 2019
@oliviertassinari oliviertassinari changed the title [Autocomplete] Add new props to accept custom titles for Autocomplete buttons [Autocomplete] Add prop for custom action labels Nov 5, 2019
@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label Nov 5, 2019
@oliviertassinari oliviertassinari added the new feature New feature or request label Nov 5, 2019
@oliviertassinari oliviertassinari self-assigned this Nov 9, 2019
@oliviertassinari oliviertassinari changed the title [Autocomplete] Add prop for custom action labels [core] Add globalization Nov 11, 2019
@oliviertassinari oliviertassinari force-pushed the add-titles-props-to-autocomplete branch 5 times, most recently from de44822 to 8de6b20 Compare November 12, 2019 12:42
@oliviertassinari oliviertassinari force-pushed the add-titles-props-to-autocomplete branch 2 times, most recently from b3d00ca to 840aec6 Compare November 12, 2019 12:56
@oliviertassinari
Copy link
Member

@soltanloo Alright, I have pushed the approach a bit further. I would love to get feedback on this. At first, I thought that a messages like object prop would be more interesting. However, at this point, we have a few components that would take advantage of this prop. I think that we can save it for later, for more text translation demanding components, maybe the data table.

I have introduced a new page in the documentation, that covers globalization. right-to-left is one part of it (maybe they should be merged?).

The quality of the translations I have done is not great. It would be awesome if native speakers can double-check them. (de-DE @eps1lon?, fr-FR @oliviertassinari, zh-CN @DDDDDanica?, ru-RU @dmtrKovalenko?, pt-BR @jaironalves?, es-ES @tkanzakic? ja-JP @yamuun?) 😄

cc @mui-org/core-contributors.

packages/material-ui/src/locale/index.js Outdated Show resolved Hide resolved
packages/material-ui/src/locale/index.js Outdated Show resolved Hide resolved
packages/material-ui/src/locale/index.js Outdated Show resolved Hide resolved
packages/material-ui/src/locale/index.js Outdated Show resolved Hide resolved
@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 12, 2019

@jaironalves and the other translators, what do you think of contributing the better translations after this effort moves forward? I understand that the current Crowdin translation mechanism doesn't account for any contribution stats on your GitHub profile, at least, this would be a way to get you guys some credit (with a commit)?

docs/src/pages/guides/localization/localization.md Outdated Show resolved Hide resolved
docs/src/pages/guides/localization/localization.md Outdated Show resolved Hide resolved
docs/src/pages/guides/localization/localization.md Outdated Show resolved Hide resolved
docs/src/pages/guides/localization/localization.md Outdated Show resolved Hide resolved
docs/translations/translations.json Outdated Show resolved Hide resolved
docs/src/pages/guides/localization/localization.md Outdated Show resolved Hide resolved
soltanloo and others added 3 commits November 15, 2019 21:25
@oliviertassinari
Copy link
Member

@soltanloo Thank you for spending time with us on this problem

@Domino987
Copy link
Contributor

@oliviertassinari That is great. Thank you for that. This will make the internationalization a lot easier.
Is it possible to append a list of all components, which are affected by the change of the language, to the docs?

@oliviertassinari
Copy link
Member

@Domino987 :). What would be the objective of such a list?

@Domino987
Copy link
Contributor

Because I already localize all my components currently and with these changes, I can remove my local localisation on the components, which already are localized now with the theme. For example the empty option of the select/autocomplete. I added that manually but I could remove that with the localisation. But I do not know, which components are affected.

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 23, 2019

@Domino987 I think that developers can expect all the Material-UI components to be localized. You should be able to remove all your custom props.

@dabretin
Copy link
Contributor

I don't really understand the orientation chosen for i18n...
It seems really weird to attach it to theme... It's really two different things...
And with the power of packagers (ex: WebPack) it's too bad to include all your translations in a single file (and not loading them on the fly).

Just my 2 cents...

PS: I've just read my comment and it's prehaps irrevelevant because I speak about internationalization and not localization... (by the way, is it so different ?)

@oliviertassinari
Copy link
Member

@dabretin Thanks for the feedback.

@Floriferous
Copy link
Contributor

Floriferous commented May 13, 2020

Is it possible to import only a specific locale instead of importing the entire locale.js file? We only need a handful of them yet we're importing all of it.

I'll open an issue if this is not yet possible.

import frFR from '@material-ui/core/locale/frFR';

// Instead of
import { frFR } from '@material-ui/core/locale';

@oliviertassinari
Copy link
Member

@Floriferous What's your concern? The unused locales are tree shaken in production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete should accept props for title for Buttons