Translations - Crowdin, Set workspace member locale on signup, and optimizations (#10091)

More progress on translations:
- Migrate from translations.io to crowdin
- Optimize performance and robustness 
- Set workspaceMember/user locale upon signup
This commit is contained in:
Félix Malfait
2025-02-09 22:10:41 +01:00
committed by GitHub
parent fd3f01ab80
commit bb24c97f80
163 changed files with 84053 additions and 2554 deletions

View File

@ -197,6 +197,7 @@ export class AuthResolver {
const { userData } = this.authService.formatUserDataPayload(
{
email: signUpInput.email,
locale: signUpInput.locale,
},
existingUser,
);

View File

@ -18,8 +18,8 @@ import { GoogleProviderEnabledGuard } from 'src/engine/core-modules/auth/guards/
import { AuthService } from 'src/engine/core-modules/auth/services/auth.service';
import { GoogleRequest } from 'src/engine/core-modules/auth/strategies/google.auth.strategy';
import { LoginTokenService } from 'src/engine/core-modules/auth/token/services/login-token.service';
import { User } from 'src/engine/core-modules/user/user.entity';
import { GuardRedirectService } from 'src/engine/core-modules/guard-redirect/services/guard-redirect.service';
import { User } from 'src/engine/core-modules/user/user.entity';
@Controller('auth/google')
@UseFilters(AuthRestApiExceptionFilter)
@ -51,6 +51,7 @@ export class GoogleAuthController {
workspaceInviteHash,
workspaceId,
billingCheckoutSessionState,
locale,
} = req.user;
const currentWorkspace = await this.authService.findWorkspaceForSignInUp({
@ -79,6 +80,7 @@ export class GoogleAuthController {
lastName,
email,
picture,
locale,
},
existingUser,
);

View File

@ -17,8 +17,8 @@ import { MicrosoftProviderEnabledGuard } from 'src/engine/core-modules/auth/guar
import { AuthService } from 'src/engine/core-modules/auth/services/auth.service';
import { MicrosoftRequest } from 'src/engine/core-modules/auth/strategies/microsoft.auth.strategy';
import { LoginTokenService } from 'src/engine/core-modules/auth/token/services/login-token.service';
import { User } from 'src/engine/core-modules/user/user.entity';
import { GuardRedirectService } from 'src/engine/core-modules/guard-redirect/services/guard-redirect.service';
import { User } from 'src/engine/core-modules/user/user.entity';
@Controller('auth/microsoft')
@UseFilters(AuthRestApiExceptionFilter)
@ -52,6 +52,7 @@ export class MicrosoftAuthController {
workspaceInviteHash,
workspaceId,
billingCheckoutSessionState,
locale,
} = req.user;
const currentWorkspace = await this.authService.findWorkspaceForSignInUp({
@ -80,6 +81,7 @@ export class MicrosoftAuthController {
lastName,
email,
picture,
locale,
},
existingUser,
);

View File

@ -1,6 +1,7 @@
import { ArgsType, Field } from '@nestjs/graphql';
import { IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { APP_LOCALES } from 'twenty-shared';
@ArgsType()
export class SignUpInput {
@ -33,4 +34,9 @@ export class SignUpInput {
@IsString()
@IsOptional()
captchaToken?: string;
@Field(() => String, { nullable: true })
@IsString()
@IsOptional()
locale?: keyof typeof APP_LOCALES;
}

View File

@ -3,6 +3,7 @@ import { PassportStrategy } from '@nestjs/passport';
import { Request } from 'express';
import { Strategy, VerifyCallback } from 'passport-google-oauth20';
import { APP_LOCALES } from 'twenty-shared';
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
@ -15,6 +16,7 @@ export type GoogleRequest = Omit<
lastName?: string | null;
email: string;
picture: string | null;
locale?: keyof typeof APP_LOCALES | null;
workspaceInviteHash?: string;
workspacePersonalInviteToken?: string;
workspaceId?: string;
@ -70,6 +72,7 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
workspacePersonalInviteToken: state.workspacePersonalInviteToken,
workspaceId: state.workspaceId,
billingCheckoutSessionState: state.billingCheckoutSessionState,
locale: state.locale,
};
done(null, user);

View File

@ -3,6 +3,7 @@ import { PassportStrategy } from '@nestjs/passport';
import { Request } from 'express';
import { VerifyCallback } from 'passport-google-oauth20';
import { Strategy } from 'passport-microsoft';
import { APP_LOCALES } from 'twenty-shared';
import {
AuthException,
@ -19,6 +20,7 @@ export type MicrosoftRequest = Omit<
lastName?: string | null;
email: string;
picture: string | null;
locale?: keyof typeof APP_LOCALES | null;
workspaceInviteHash?: string;
workspacePersonalInviteToken?: string;
workspaceId?: string;
@ -44,6 +46,7 @@ export class MicrosoftStrategy extends PassportStrategy(Strategy, 'microsoft') {
state: JSON.stringify({
workspaceInviteHash: req.query.workspaceInviteHash,
workspaceId: req.params.workspaceId,
locale: req.query.locale,
billingCheckoutSessionState: req.query.billingCheckoutSessionState,
workspacePersonalInviteToken: req.query.workspacePersonalInviteToken,
}),
@ -84,6 +87,7 @@ export class MicrosoftStrategy extends PassportStrategy(Strategy, 'microsoft') {
workspacePersonalInviteToken: state.workspacePersonalInviteToken,
workspaceId: state.workspaceId,
billingCheckoutSessionState: state.billingCheckoutSessionState,
locale: state.locale,
};
done(null, user);

View File

@ -1,6 +1,8 @@
import { APP_LOCALES } from 'twenty-shared';
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
import { User } from 'src/engine/core-modules/user/user.entity';
import { WorkspaceAuthProvider } from 'src/engine/core-modules/workspace/types/workspace.type';
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
export type SignInUpBaseParams = {
@ -15,6 +17,7 @@ export type SignInUpNewUserPayload = {
lastName?: string | null;
picture?: string | null;
passwordHash?: string | null;
locale?: keyof typeof APP_LOCALES | null;
};
export type PartialUserWithPicture = {