Skip to content

Commit

Permalink
Add missing translation for code copied message
Browse files Browse the repository at this point in the history
  • Loading branch information
jlcvp committed Sep 3, 2024
1 parent 56cc434 commit db95668
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/app/components/account-detail/account-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ToastController } from '@ionic/angular';
import { Account2FA } from 'src/app/models/account2FA.model';
import { OtpService } from 'src/app/services/otp.service';
import { CountdownTimerComponent } from '../countdown-timer/countdown-timer.component';
import { debounceTime, pipe } from 'rxjs';
import { debounceTime, firstValueFrom, pipe } from 'rxjs';
import { TranslateService } from '@ngx-translate/core';

@Component({
selector: 'app-account-detail',
Expand Down Expand Up @@ -40,7 +41,7 @@ export class AccountDetailComponent {
return this._account
}

constructor(private otpService: OtpService, private toastController: ToastController) { }
constructor(private otpService: OtpService, private toastController: ToastController, private translateService: TranslateService) { }

set token(value: string) {
if(value.length <= 4) { // if token length is 4 or less, use it as is
Expand Down Expand Up @@ -89,8 +90,9 @@ export class AccountDetailComponent {
const code = this.token.replace(/\s/g, '')
await navigator.clipboard.writeText(code)
console.log("code copied")
const message = await firstValueFrom(this.translateService.get('ACCOUNT_DETAIL.CODE_COPIED'))
const toast = await this.toastController.create({
message: `Código copiado`,
message,
positionAnchor: evt.target,
//position: 'middle'
mode: 'md',
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"ACCOUNT_DETAIL": {
"SECONDS_SHORT": "s",
"SELECT_ACCOUNT_HINT": "Select an account to start..."
"SELECT_ACCOUNT_HINT": "Select an account to start...",
"CODE_COPIED": "Code copied to clipboard"
},
"ADD_ACCOUNT_MODAL": {
"ADDING_ACCOUNT": "Adding account...",
Expand Down
3 changes: 2 additions & 1 deletion src/assets/i18n/pt.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"ACCOUNT_DETAIL": {
"SECONDS_SHORT": "s",
"SELECT_ACCOUNT_HINT": "Selecione uma conta para iniciar..."
"SELECT_ACCOUNT_HINT": "Selecione uma conta para iniciar...",
"CODE_COPIED": "Código copiado para a área de transferência"
},
"ADD_ACCOUNT_MODAL": {
"ADDING_ACCOUNT": "Adicionando conta...",
Expand Down

0 comments on commit db95668

Please sign in to comment.