diff --git a/app/models/Team.js b/app/models/Team.js index f25bbc4d34..73b5647bb0 100644 --- a/app/models/Team.js +++ b/app/models/Team.js @@ -5,7 +5,6 @@ import BaseModel from "./BaseModel"; class Team extends BaseModel { id: string; name: string; - language: string; avatarUrl: string; slackConnected: boolean; googleConnected: boolean; diff --git a/app/models/User.js b/app/models/User.js index cc732833b1..07c1caf25d 100644 --- a/app/models/User.js +++ b/app/models/User.js @@ -10,6 +10,7 @@ class User extends BaseModel { lastActiveAt: string; isSuspended: boolean; createdAt: string; + language: string; } export default User; diff --git a/app/scenes/Settings/Details.js b/app/scenes/Settings/Details.js index b048fcb178..bc54c3a5c2 100644 --- a/app/scenes/Settings/Details.js +++ b/app/scenes/Settings/Details.js @@ -11,7 +11,6 @@ import CenteredContent from "components/CenteredContent"; import Flex from "components/Flex"; import HelpText from "components/HelpText"; import Input, { LabelText } from "components/Input"; -import InputSelect from "components/InputSelect"; import PageTitle from "components/PageTitle"; import ImageUpload from "./components/ImageUpload"; import env from "env"; @@ -27,7 +26,6 @@ class Details extends React.Component { form: ?HTMLFormElement; @observable name: string; - @observable language: string; @observable subdomain: ?string; @observable avatarUrl: ?string; @@ -35,7 +33,6 @@ class Details extends React.Component { const { team } = this.props.auth; if (team) { this.name = team.name; - this.language = team.language; this.subdomain = team.subdomain; } } @@ -52,7 +49,6 @@ class Details extends React.Component { try { await this.props.auth.updateTeam({ name: this.name, - language: this.language, avatarUrl: this.avatarUrl, subdomain: this.subdomain, }); @@ -66,10 +62,6 @@ class Details extends React.Component { this.name = ev.target.value; }; - handleLanguageChange = (ev: SyntheticInputEvent<*>) => { - this.language = ev.target.value; - }; - handleSubdomainChange = (ev: SyntheticInputEvent<*>) => { this.subdomain = ev.target.value.toLowerCase(); }; @@ -127,16 +119,6 @@ class Details extends React.Component { required short /> - {env.SUBDOMAINS_ENABLED && ( <> { @observable name: string; @observable avatarUrl: ?string; @observable showDeleteModal: boolean = false; + @observable language: string; componentDidMount() { if (this.props.auth.user) { this.name = this.props.auth.user.name; + this.language = this.props.auth.user.language; } } @@ -44,8 +48,12 @@ class Profile extends React.Component { await this.props.auth.updateUser({ name: this.name, avatarUrl: this.avatarUrl, + language: this.language, }); - this.props.ui.showToast("Profile saved"); + this.props.ui.showToast(t("Profile saved")); + setTimeout(function () { + window.location.reload(); + }, 1000); }; handleNameChange = (ev: SyntheticInputEvent<*>) => { @@ -58,11 +66,15 @@ class Profile extends React.Component { await this.props.auth.updateUser({ avatarUrl: this.avatarUrl, }); - this.props.ui.showToast("Profile picture updated"); + this.props.ui.showToast(t("Profile picture updated")); }; handleAvatarError = (error: ?string) => { - this.props.ui.showToast(error || "Unable to upload new avatar"); + this.props.ui.showToast(error || t("Unable to upload new avatar")); + }; + + handleLanguageChange = (ev: SyntheticInputEvent<*>) => { + this.language = ev.target.value; }; toggleDeleteAccount = () => { @@ -80,10 +92,10 @@ class Profile extends React.Component { return ( - -

Profile

+ +

{t("Profile")}

- Photo + {t("Photo")} { > - Upload + {t("Upload")}
(this.form = ref)}> + - Delete Account + {t("Delete Account")}

- You may delete your account at any time, note that this is - unrecoverable.{" "} - Delete account. + {t( + "You may delete your account at any time, note that this is unrecoverable" + )} + . {t("Delete account")}.

{this.showDeleteModal && ( diff --git a/app/stores/AuthStore.js b/app/stores/AuthStore.js index dbc775075d..62f3fe1789 100644 --- a/app/stores/AuthStore.js +++ b/app/stores/AuthStore.js @@ -126,7 +126,7 @@ export default class AuthStore { this.user = new User(user); this.team = new Team(team); - i18n.changeLanguage(this.team.language); + i18n.changeLanguage(this.user.language); if (window.Sentry) { window.Sentry.configureScope(function (scope) { diff --git a/i18next-parser.config.js b/i18next-parser.config.js index 1ec84ffd80..04fc408475 100644 --- a/i18next-parser.config.js +++ b/i18next-parser.config.js @@ -17,7 +17,7 @@ module.exports = { keepRemoved: false, // Keep keys from the catalog that are no longer in code - keySeparator: '$', + keySeparator: false, // Key separator used in your translation keys // If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance. diff --git a/package.json b/package.json index b51def88af..99e39b4a2e 100644 --- a/package.json +++ b/package.json @@ -185,8 +185,8 @@ "eslint-plugin-react-hooks": "^4.1.0", "fetch-test-server": "^1.1.0", "flow-bin": "^0.104.0", - "i18next-parser": "^3.3.0", "html-webpack-plugin": "3.2.0", + "i18next-parser": "^3.3.0", "jest-cli": "^26.0.0", "koa-webpack-dev-middleware": "^1.4.5", "koa-webpack-hot-middleware": "^1.0.3", diff --git a/server/api/team.js b/server/api/team.js index 0d81346d6e..ff58942884 100644 --- a/server/api/team.js +++ b/server/api/team.js @@ -12,7 +12,6 @@ const router = new Router(); router.post("team.update", auth(), async (ctx) => { const { name, - language, avatarUrl, subdomain, sharing, @@ -28,7 +27,6 @@ router.post("team.update", auth(), async (ctx) => { } if (name) team.name = name; - if (language) team.language = language; if (sharing !== undefined) team.sharing = sharing; if (documentEmbeds !== undefined) team.documentEmbeds = documentEmbeds; if (guestSignin !== undefined) team.guestSignin = guestSignin; diff --git a/server/api/users.js b/server/api/users.js index 7e3b06f70c..1c71985819 100644 --- a/server/api/users.js +++ b/server/api/users.js @@ -62,10 +62,11 @@ router.post("users.info", auth(), async (ctx) => { router.post("users.update", auth(), async (ctx) => { const { user } = ctx.state; - const { name, avatarUrl } = ctx.body; + const { name, avatarUrl, language } = ctx.body; if (name) user.name = name; if (avatarUrl) user.avatarUrl = avatarUrl; + if (language) user.language = language; await user.save(); diff --git a/server/migrations/20201106122752-i18n.js b/server/migrations/20201106122752-i18n.js index 971a99387d..3478862742 100644 --- a/server/migrations/20201106122752-i18n.js +++ b/server/migrations/20201106122752-i18n.js @@ -2,13 +2,13 @@ module.exports = { up: async (queryInterface, Sequelize) => { - await queryInterface.addColumn('teams', 'language', { + await queryInterface.addColumn('users', 'language', { type: Sequelize.STRING, defaultValue: process.env.DEFAULT_LANGUAGE, }); }, down: async (queryInterface, Sequelize) => { - await queryInterface.removeColumn('teams', 'language'); + await queryInterface.removeColumn('users', 'language'); } }; diff --git a/server/models/Team.js b/server/models/Team.js index e9cd1e2571..f0f3c86072 100644 --- a/server/models/Team.js +++ b/server/models/Team.js @@ -4,7 +4,6 @@ import path from "path"; import { URL } from "url"; import util from "util"; import uuid from "uuid"; -import { t } from "../../shared/translations/i18n"; import { stripSubdomain, RESERVED_SUBDOMAINS, @@ -28,10 +27,6 @@ const Team = sequelize.define( primaryKey: true, }, name: DataTypes.STRING, - language: { - type: DataTypes.STRING, - defaultValue: process.env.DEFAULT_LANGUAGE, - }, subdomain: { type: DataTypes.STRING, allowNull: true, @@ -144,10 +139,9 @@ Team.prototype.provisionSubdomain = async function (subdomain) { Team.prototype.provisionFirstCollection = async function (userId) { const collection = await Collection.create({ - name: t("Welcome"), - description: t( - "This collection is a quick guide to what Outline is all about. Feel free to delete this collection once your team is up to speed with the basics!" - ), + name: "Welcome", + description: + "This collection is a quick guide to what Outline is all about. Feel free to delete this collection once your team is up to speed with the basics!", type: "atlas", teamId: this.id, creatorId: userId, @@ -156,10 +150,10 @@ Team.prototype.provisionFirstCollection = async function (userId) { // For the first collection we go ahead and create some intitial documents to get // the team started. You can edit these in /server/onboarding/x.md const onboardingDocs = [ - t("Support"), - t("Integrations & API"), - t("Our Editor"), - t("What is Outline"), + "Support", + "Integrations & API", + "Our Editor", + "What is Outline", ]; for (const title of onboardingDocs) { const text = await readFile( @@ -170,7 +164,6 @@ Team.prototype.provisionFirstCollection = async function (userId) { "..", "server", "onboarding", - process.env.DEFAULT_LANGUAGE, `${title}.md` ), "utf8" diff --git a/server/models/User.js b/server/models/User.js index 0f55218967..553b6e54d7 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -36,6 +36,10 @@ const User = sequelize.define( lastSigninEmailSentAt: DataTypes.DATE, suspendedAt: DataTypes.DATE, suspendedById: DataTypes.UUID, + language: { + type: DataTypes.STRING, + defaultValue: process.env.DEFAULT_LANGUAGE, + }, }, { paranoid: true, diff --git a/server/onboarding/en_US/Integrations & API.md b/server/onboarding/Integrations & API.md similarity index 100% rename from server/onboarding/en_US/Integrations & API.md rename to server/onboarding/Integrations & API.md diff --git a/server/onboarding/en_US/Our Editor.md b/server/onboarding/Our Editor.md similarity index 100% rename from server/onboarding/en_US/Our Editor.md rename to server/onboarding/Our Editor.md diff --git a/server/onboarding/de_DE/Support.md b/server/onboarding/Support.md similarity index 100% rename from server/onboarding/de_DE/Support.md rename to server/onboarding/Support.md diff --git a/server/onboarding/en_US/What is Outline.md b/server/onboarding/What is Outline.md similarity index 100% rename from server/onboarding/en_US/What is Outline.md rename to server/onboarding/What is Outline.md diff --git a/server/onboarding/de_DE/Integrationen & API.md b/server/onboarding/de_DE/Integrationen & API.md deleted file mode 100644 index 142fcf135d..0000000000 --- a/server/onboarding/de_DE/Integrationen & API.md +++ /dev/null @@ -1,29 +0,0 @@ -## Integrations - -Outline supports many of the most popular tools on the market without any additional settings or configuration. Just paste links to a YouTube video, Figma file, or Google Spreadsheet to get instant live-embeds in your documents. Take a look at the [integrations directory](https://www.getoutline.com/integrations) for a list of all of the tools that are supported. - -Our integration code is also [open-source](https://github.com/outline/outline) and we encourage third party developers and the community to build support for additional tools! - -:::info -Most integrations work by simply pasting a link from a supported service into a document. -::: - - -## Slack - -If your team is using Slack to communicate then you’ll definitely want to enable our [Slack Integration](/settings/integrations/slack) to get instant link unfurling for Outline documents and access to the `/outline` slash command to search your knowledge base directly from Slack. - -## API - -Have some technical skills? Outline is built on a fully featured RPC-style [API](https://www.getoutline.com/developers). Create (or even append to) documents, collections, provision users, and more programmatically. All documents are edited and stored in markdown format – try out this example CURL request to get started: - -```bash -curl -XPOST -H "Content-type: application/json" -d '{ - "title": "My first document", - "text": "Hello from the API 👋", - "collectionId": "COLLECTION_ID", // find the collection id in the URL bar - "token": "API_TOKEN", // get an API token from https://www.getoutline.com/settings/tokens - "publish": true -}' 'https://www.getoutline.com/api/documents.create' -``` - diff --git a/server/onboarding/de_DE/Unser Editor.md b/server/onboarding/de_DE/Unser Editor.md deleted file mode 100644 index 538abe78c8..0000000000 --- a/server/onboarding/de_DE/Unser Editor.md +++ /dev/null @@ -1,24 +0,0 @@ -Das Herzstück von Outline ist der Dokumenteditor. Wir lassen Sie nach Belieben schreiben - sei es Markdown, WYSIWYG oder die vielen Tastenkombinationen. - -## Abschrift - -Wenn Sie mit dem Schreiben von Markdowns vertraut sind, werden alle gewohnten Verknüpfungen unterstützt. Geben Sie beispielsweise \ * \ * fett \ * \ * ein, um sofort fett gedruckten Text zu erstellen. Wenn Sie eine Syntax vergessen haben oder nach einer kurzen Auffrischung auf das Tastatursymbol in der unteren rechten Ecke klicken, um unsere Anleitung zu erhalten. Wenn Sie einige der wichtigsten Markdown-Verknüpfungen kennenlernen, wird die Verwendung von Outline schneller und angenehmer! - -! [Die Formatierungssymbolleiste] (/ images / Screenshots / formatating-toolbar.png) - -:::die Info -Sie können Markdown oder HTML auch von einer anderen Stelle direkt in ein Dokument einfügen. -::: - - -## Reichhaltige Dokumente - -Der Editor unterstützt eine Vielzahl von Inhaltsblöcken, darunter Bilder, Tabellen, Listen, Zitate, Videos und mehr. Geben Sie "/" in eine leere Zeile ein oder klicken Sie auf das Symbol "+", um das Menü zum Einfügen von Blöcken auszulösen. Sie können weiter tippen, um es herauszufiltern. - -Sie können Bilder auch ziehen und ablegen, um sie in Ihr Dokument aufzunehmen, oder einen Link einfügen, um Inhalte aus einer der vielen unterstützten [Integrationen] einzubetten (https://www.getoutline.com/integrations). - -! [Das Blockmenü] (/ images / reviewshots / block-menu.png) - -## Verweise - -Durch das Verknüpfen mit einem anderen Dokument werden automatisch Backlinks erstellt, die auf dem neuesten Stand gehalten und am unteren Rand des Dokuments angezeigt werden. Sie können also eine Bibliothek mit verknüpften Informationen erstellen und die Frage "Welche anderen Dokumente verlinken hier?" Einfach beantworten. \ No newline at end of file diff --git a/server/onboarding/de_DE/Was ist Outline.md b/server/onboarding/de_DE/Was ist Outline.md deleted file mode 100644 index 0ae021b432..0000000000 --- a/server/onboarding/de_DE/Was ist Outline.md +++ /dev/null @@ -1,17 +0,0 @@ -Outline is a place to build your team knowledge base, you could think of it like your team’s shared library – a place for important documentation, notes, and ideas to live and be discovered. Some things you might want to keep in Outline: - -- Documentation -- Sales playbooks -- Support scripts -- Onboarding -- HR documents -- Meeting notes -- …and more - -## Structure - -Outline allows you to organize documents in "collections", for example these could represent topics like Sales, Product, or HR. Within collections documents can be interlinked and deeply nested to easily build relationships within your knowledge base. - -## Search - -Outline is built from the ground up to be really fast, and that includes [search](/search). You can start searching from anywhere with the `CMD+K` shortcut – then filter by time, author, and more to find the information you need. Or you can search from within Slack with the `/outline` slash command. \ No newline at end of file diff --git a/server/onboarding/en_US/Support.md b/server/onboarding/en_US/Support.md deleted file mode 100644 index b6870bb79b..0000000000 --- a/server/onboarding/en_US/Support.md +++ /dev/null @@ -1,9 +0,0 @@ -We hate bugs as much as you and do everything possible to keep the application bug-free and performant. If you see any problems with Outline please get in touch with the team – you can email [hello@getoutline.com](mailto:hello@getoutline.com) directly and we’ll get back to you (hopefully with a fix!) as soon as possible. - -## GitHub - -If you have a GitHub account then you can also submit bugs directly to the development team on our public [issue tracker](https://github.com/outline/outline/issues). - -## Ideas - -We’d love to hear your ideas about how Outline can be improved and features you would like to see built. The best place to let the team know is through [GitHub discussions](https://github.com/outline/outline/discussions). diff --git a/server/presenters/team.js b/server/presenters/team.js index 925804ab4c..bc75d9d8ef 100644 --- a/server/presenters/team.js +++ b/server/presenters/team.js @@ -5,7 +5,6 @@ export default function present(team: Team) { return { id: team.id, name: team.name, - language: team.language, avatarUrl: team.logoUrl, slackConnected: !!team.slackId, googleConnected: !!team.googleId, diff --git a/server/presenters/user.js b/server/presenters/user.js index a0bf2071a7..9f4ed16f37 100644 --- a/server/presenters/user.js +++ b/server/presenters/user.js @@ -12,6 +12,7 @@ type UserPresentation = { email?: string, isAdmin: boolean, isSuspended: boolean, + language: string, }; export default (user: User, options: Options = {}): ?UserPresentation => { @@ -23,6 +24,7 @@ export default (user: User, options: Options = {}): ?UserPresentation => { userData.isAdmin = user.isAdmin; userData.isSuspended = user.isSuspended; userData.avatarUrl = user.avatarUrl; + userData.language = user.language; if (options.includeDetails) { userData.email = user.email; diff --git a/shared/translations/de_DE.json b/shared/translations/de_DE.json index 155c6655ab..d14c09e442 100644 --- a/shared/translations/de_DE.json +++ b/shared/translations/de_DE.json @@ -3,13 +3,17 @@ "Recently updated": "Zuletzt geändert", "Recently viewed": "Zuletzt gesehen", "Created by me": "Von mir erstellt", - "Welcome": "Willkommen", - "This collection is a quick guide to what Outline is all about. Feel free to delete this collection once your team is up to speed with the basics!": "Diese Sammlung ist eine Kurzanleitung für Outline. Fühlen Sie sich frei, diese Sammlung zu löschen, sobald Ihr Team mit den Grundlagen vertraut ist!", - "Support": "Support", - "Integrations & API": "Integrationen & API", - "Our Editor": "Unser Editor", - "What is Outline": "Was ist Outline", - "Our team’s knowledge base": "Die Wissensbasis unseres Teams", - "Team wiki, documentation, meeting notes, playbooks, onboarding, work logs, brainstorming, & more…": "Team-Wiki, Dokumentation, Besprechungsnotizen, Spielbücher, Onboarding, Arbeitsprotokolle, Brainstorming und mehr…" -} - \ No newline at end of file + "Profile saved": "Profil gespeichert", + "Profile picture updated": "Profilfoto wurde aktualisiert.", + "Unable to upload new avatar": "Neuer Avatar kann nicht hochgeladen werden.", + "Profile": "Profil", + "Photo": "Foto", + "Upload": "Hochladen", + "Full name": "Vorname", + "Language": "Sprache", + "Saving…": "Am speichern…", + "Save": "Speichern", + "Delete Account": "Konto löschen", + "You may delete your account at any time, note that this is unrecoverable": "Sie können Ihr Konto jederzeit löschen. Beachten Sie, dass dies nicht wiederherstellbar ist", + "Delete account": "Konto löschen" + } \ No newline at end of file diff --git a/shared/translations/default.json b/shared/translations/default.json index 77827d9336..a1d8afec60 100644 --- a/shared/translations/default.json +++ b/shared/translations/default.json @@ -3,10 +3,17 @@ "Recently updated": "Recently updated", "Recently viewed": "Recently viewed", "Created by me": "Created by me", - "Welcome": "Welcome", - "This collection is a quick guide to what Outline is all about. Feel free to delete this collection once your team is up to speed with the basics!": "This collection is a quick guide to what Outline is all about. Feel free to delete this collection once your team is up to speed with the basics!", - "Support": "Support", - "Integrations & API": "Integrations & API", - "Our Editor": "Our Editor", - "What is Outline": "What is Outline" + "Profile saved": "Profile saved", + "Profile picture updated": "Profile picture updated", + "Unable to upload new avatar": "Unable to upload new avatar", + "Profile": "Profile", + "Photo": "Photo", + "Upload": "Upload", + "Full name": "Full name", + "Language": "Language", + "Saving…": "Saving…", + "Save": "Save", + "Delete Account": "Delete Account", + "You may delete your account at any time, note that this is unrecoverable": "You may delete your account at any time, note that this is unrecoverable", + "Delete account": "Delete account" } diff --git a/shared/translations/i18n.js b/shared/translations/i18n.js index 05ad7a59aa..da25201c5b 100644 --- a/shared/translations/i18n.js +++ b/shared/translations/i18n.js @@ -13,6 +13,7 @@ i18n.use(initReactI18next).init({ useSuspense: false, }, lng: process.env.DEFAULT_LANGUAGE, + debug: process.env.NODE_ENV !== "production", resources: { en_US: { translation: en_US,