Adjust how locales are handled

Allows POEditor to be the main copy of translated strings (aside from en-US)
This commit is contained in:
Zack Rauen 2021-04-15 22:18:17 -04:00
parent 2779d9bc4f
commit 2ace4925a2
35 changed files with 192 additions and 20 deletions

68
CHANGELOG.md Normal file
View File

@ -0,0 +1,68 @@
# BetterDiscord Changelog
This changelog starts with the restructured 1.0.0 release that happened after context isolation changes. The changelogs here should more-or-less mirror the ones that get shown in the client but probably with less formatting and pizzazz.
## Unreleased
### Added
- Added an option to prevent Discord from hijacking the media keys.
- Added command line flag to launch a vanilla version of Discord `--vanilla`
- Added an option for app-wide `ctrl+shift+c` shortcut for inspect element.
- Added emote blocklist to `BdApi` via `BdApi.Emotes.blocklist`.
- Added the ability to remove Discord's forced minimum window size.
- Added a basic core updater to hopefully prevent the need for future installs.
- Added an option to log out all console logs to file for developers.
- Added an option to disable Discord's console warning.
### Removed
- Class normalizer was removed as it does more harm than good.
### Changed
- Addon error modals got a makeover thanks to [Strencher](https://github.com/Strencher) and [Tropical](https://github.com/Tropix126)
- Emotes are now downloaded as a single asar bundle as opposed to individual JSON files.
- Strings are now bundles with the main payload, but may move to a separate asar like the emotes.
- `BdApi` functions related to window preferences no longer work and are deprecated.
- Guild classes are obtained later from webpack in case it's not loaded in fast enough.
- DataStore now has additional protections (`try..catch`).
### Fixed
- Fixed an issue with old METAs used in themes cause the css to render invalid.
- Fixed crashing issues with plugins using `Buffer`.
- Fixed a bug for manual and 3rd party installations that don't create the BD folder.
- Fixed incorrect path usage for some Mac devices.
- Fixed colored text not doing anything.
- Fixed detached css window not loading saved css.
- Fixed an issue where toggling settings collections would remove incorrect panels.
- Fixed the file watchers not properly matching duplicate files.
- Fixed Hide GIF and Hide Gift options for Discord's changes
- Fixed public servers button not showing.
- Fixed multiple error modals showing on startup if multiple plugins had errors.
- Fixed incorrect styling on emotes.
- Fixed system editor edit buttons using an old Electron API (`openItem` vs `openPath`)
## 1.0.0
### Added
- **Everything** is entirely rewritten, for better or worse.
- **Emotes and Custom CSS** can be completely turned off for those not interested. It saves on memory too by not loading those components.
- **Floating editors** for both custom css and plugins/themes are now available.
- **Monaco** is now used as the main CSS editor, in place of Ace.
- **Settings panels** are completely new and sleek. They are also highly extensible for potential future features :eyes:
- **Translations** are now integrated starting with only a couple languages, but feel free to contribute your own!
- **Public servers** got a new makeover thanks to some design help from Tropical and Gibbu!
We added settings to hide the **Gif Picker** and the **Nitro Gift** buttons in the textarea.
### Changed
- **Patcher API** was added to `BdApi` under `BdApi.Patcher`. The old `BdApi.monkeyPatch` was patched to use the Patcher as well. This allows plugins and patches to play nice with one another.
- **jQuery** was removed from dependencies.
- **General performance** improvements throughout the app, from startup to emotes to addons.
- **Exporting** by plugins is now highly encouraged over trying to match your meta name and class name.
- **Plugins and Themes** pages have more options for sorting, views and more. The entire panel got a facelift!
- **Blankslates** have been added all over for that added UX.
- **Several unused UI features** have been removed for a more performant and usable experience.
- **Debugger Hotkey** is now a built-in feature!
### Fixed
- **Minimal mode** has been redesigned from the ground up and now works as intended.
- **Emote menus** are fixed and now use React Patching to properly integrate into the new Emoji Picker. (Thanks Strencher#1044!)

1
assets/locales/bg.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/cs.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/da.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/el.json Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

1
assets/locales/fi.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/hi.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/hr.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/hu.json Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -1,6 +1,82 @@
/* eslint-disable no-multi-spaces */
module.exports = {
en: require("./en.json"),
de: require("./de.json"),
ja: require("./ja.json"),
sv: require("./sv.json")
};
"en-US": require("./en-us.json"), // English, US
"en-GB": require("./en-gb.json"), // English, UK
"zh-CN": require("./zh-cn.json"), // Chinese, Simplified
"zh-TW": require("./zh-tw.json"), // Chinese, Traditional
"cs": require("./cs.json"), // Czech
"da": require("./da.json"), // Danish
"nl": require("./nl.json"), // Dutch
"fr": require("./fr.json"), // French
"de": require("./de.json"), // German
"el": require("./el.json"), // Greek
"hu": require("./hu.json"), // Hungarian
"it": require("./it.json"), // Italian
"ja": require("./ja.json"), // Japanese
"ko": require("./ko.json"), // Korean
"pl": require("./pl.json"), // Polish
"pt-PT": require("./pt-pt.json"), // Portuguese, Portugal
"pt-BR": require("./pt-br.json"), // Protuguese, Brazil
"ru": require("./ru.json"), // Russian
"sk": require("./sk.json"), // Slovak
"es-ES": require("./es-es.json"), // Spanish (Spain)
"sv-SE": require("./sv-se.json"), // Swedish
"tr": require("./tr.json"), // Turkish
"bg": require("./bg.json"), // Bulgarian
"uk": require("./uk.json"), // Ukrainian
"fi": require("./fi.json"), // Finnish
"no": require("./no.json"), // Norwegian
"hr": require("./hr.json"), // Croation
"ro": require("./ro.json"), // Romanian
"lt": require("./lt.json"), // Lithuanian
"th": require("./th.json"), // Thai
"vi": require("./vi.json"), // Vietnamese
"hi": require("./hi.json"), // Hindi
};
/*
The following is the list of Discord's available locales as of April 15th 2021
English, US: en-US
English, UK: en-GB
Chinese Simplified:
Traditional Chinese: zh-TW
Czech: cs
Danish: da
Dutch: nl
French: fr
German: de
Greek: el
Hungarian: hu
Italian: it
Japanese: ja
Korean: ko
Polish: pl
Portuguese: pt-PT
Portuguese, Brazilian: pt-BR
Russian: ru
Slovak: sk
Spanish: es-ES
Swedish: sv-SE
Turkish: tr
Bulgarian: bg
Ukrainian: uk
Finnish: fi
Norwegian: no
Croatian: hr
Romanian: ro
Lithuanian: lt
Thai: th
Vietnamese: vi
Hindi: hi
List was retrieved using: DiscordModules.LocaleManager.getLanguages().map(l => `${l.englishName}: ${l.code}`)
This means that the above list includes locales that exist in their current system, but are not yet available to select via UI.
That list can be checked with DiscordModules.LocaleManager.getAvailableLocales()
*/

1
assets/locales/it.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/ko.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/lt.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/nl.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/no.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/pl.json Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

1
assets/locales/ro.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/ru.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/sk.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/th.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/tr.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/uk.json Normal file
View File

@ -0,0 +1 @@
{}

1
assets/locales/vi.json Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -6,8 +6,8 @@ import Events from "./emitter";
const {Dispatcher, DiscordConstants, UserSettingsStore} = DiscordModules;
export default new class LocaleManager {
get discordLocale() {return UserSettingsStore.locale.split("-")[0];}
get defaultLocale() {return "en";}
get discordLocale() {return UserSettingsStore.locale;}
get defaultLocale() {return "en-US";}
constructor() {
this.locale = "";
@ -18,7 +18,7 @@ export default new class LocaleManager {
this.setLocale(this.discordLocale);
Dispatcher.subscribe(DiscordConstants.ActionTypes.USER_SETTINGS_UPDATE, ({settings}) => {
const newLocale = settings.locale;
if (newLocale && newLocale != this.locale) this.setLocale(newLocale.split("-")[0]);
if (newLocale && newLocale != this.locale) this.setLocale(newLocale);
});
}

View File

@ -8,11 +8,12 @@
--switch-color: rgb(114, 118, 125);
--symbol1path: path('M5.13231 6.72963L6.7233 5.13864L14.855 13.2704L13.264 14.8614L5.13231 6.72963Z');
--symbol2path: path('M13.2704 5.13864L14.8614 6.72963L6.72963 14.8614L5.13864 13.2704L13.2704 5.13864Z');
border-radius: 14px;
width: 40px;
height: 24px;
background-color: var(--switch-color);
transition: 250ms cubic-bezier(0, .3, .7, 1) background-color;
transition: 250ms cubic-bezier(0, 0.3, 0.7, 1) background-color;
position: relative;
}
@ -20,17 +21,17 @@
--switch-color: rgba(100, 137, 126);
}
.full-motion .bd-switch input:active + .bd-switch-body {
--symbol1path: path('M6.56666 11.0013L6.56666 8.96683L13.5667 8.96683L13.5667 11.0013L6.56666 11.0013Z');
--symbol2path: path('M13.5582 8.96683L13.5582 11.0013L6.56192 11.0013L6.56192 8.96683L13.5582 8.96683Z');
}
.bd-switch input:checked + .bd-switch-body {
--switch-color: rgb(67, 181, 129);
--symbol1path: path('M7.89561 14.8538L6.30462 13.2629L14.3099 5.25755L15.9009 6.84854L7.89561 14.8538Z');
--symbol2path: path('M4.08643 11.0903L5.67742 9.49929L9.4485 13.2704L7.85751 14.8614L4.08643 11.0903Z');
}
.full-motion .bd-switch input:active + .bd-switch-body {
--symbol1path: path('M6.56666 11.0013L6.56666 8.96683L13.5667 8.96683L13.5667 11.0013L6.56666 11.0013Z');
--symbol2path: path('M13.5582 8.96683L13.5582 11.0013L6.56192 11.0013L6.56192 8.96683L13.5582 8.96683Z');
}
.bd-switch input:checked:active + .bd-switch-body {
--switch-color: rgba(81, 162, 128);
}
@ -42,7 +43,7 @@
.bd-switch .bd-switch-symbol path {
fill: var(--switch-color);
transition: 250ms cubic-bezier(0, .3, .7, 1);
transition: 250ms cubic-bezier(0, 0.3, 0.7, 1);
}
.bd-switch .bd-switch-symbol path:first-child {
@ -71,7 +72,7 @@
width: 28px;
height: 18px;
margin: 3px;
transition: 250ms cubic-bezier(0, .3, .7, 1);
transition: 250ms cubic-bezier(0, 0.3, 0.7, 1);
}
.bd-switch input:active + .bd-switch-body .bd-switch-slider {
@ -87,7 +88,7 @@
}
.bd-switch-body .bd-switch-slider .bd-switch-handle {
transition: 250ms cubic-bezier(0, .3, .7, 1);
transition: 250ms cubic-bezier(0, 0.3, 0.7, 1);
position: relative;
}

View File

@ -45,4 +45,4 @@
.bd-tab-item:active {
background-color: var(--background-modifier-active);
}
}

View File

@ -16,8 +16,8 @@ export default class Switch extends React.Component {
render() {
const enabledClass = this.props.disabled ? " bd-switch-disabled" : "";
const checkedClass = this.state.checked ? " bd-switch-checked" : "";
return <div className={`bd-switch` + enabledClass + checkedClass} disabled={this.props.disabled} checked={this.state.checked} onChange={this.onChange}>
<input id={this.props.id} type="checkbox" />
return <div className={`bd-switch` + enabledClass + checkedClass}>
<input id={this.props.id} type="checkbox" disabled={this.props.disabled} checked={this.state.checked} onChange={this.onChange} />
<div className="bd-switch-body">
<svg className="bd-switch-slider" viewBox="0 0 28 20" preserveAspectRatio="xMinYMid meet">
<rect className="bd-switch-handle" fill="white" x="4" y="0" height="20" width="20" rx="10"></rect>