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

TW-1817 added french and russian translation in camera screen #2012

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -3086,5 +3086,21 @@
"byContinuingYourAgreeingToOur": "By continuing, you're agreeing to our",
"youDontHaveAnyContactsYet": "You dont have any contacts yet.",
"loading": "Loading...",
"errorDialogTitle": "Oops, something went wrong"
"errorDialogTitle": "Oops, something went wrong",
"shootingTips": "Tap to take photo.",
"shootingWithRecordingTips": "Tap to take photo. Long press to record video.",
"shootingOnlyRecordingTips": "Long press to record video.",
"shootingTapRecordingTips": "Tap to record video.",
"loadFailed": "Load failed",
"saving": "Saving...",
"sActionManuallyFocusHint": "Manually focus",
"sActionPreviewHint": "Preview",
"sActionRecordHint": "Record",
"sActionShootHint": "Take picture",
"sActionShootingButtonTooltip": "Shooting button",
"sActionStopRecordingHint": "Stop recording",
"sCameraLensDirectionLabel": "Camera lens direction: {value}",
"sCameraPreviewLabel": "Camera preview: {value}",
"sFlashModeLabel": "Flash mode: {mode}",
"sSwitchCameraLensDirectionLabel": "Switch to the {value} camera"
}
19 changes: 18 additions & 1 deletion assets/l10n/intl_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -3085,5 +3085,22 @@
"@searchContacts": {},
"phone": "Téléphone",
"viewProfile": "Voir le profil",
"profileInfo": "Informations du profil"
"profileInfo": "Informations du profil",
"shootingTips": "Appuyez pour prendre une photo.",
"shootingWithRecordingTips": "Appuyez pour prendre une photo. Appuyez longuement pour enregistrer une vidéo.",
"shootingOnlyRecordingTips": "Appuyez longuement pour enregistrer une vidéo.",
"shootingTapRecordingTips": "Appuyez pour enregistrer une vidéo.",
"loadFailed": "Échec du chargement",
"loading": "Chargement...",
"saving": "Enregistrement...",
"sActionManuallyFocusHint": "mettre au point manuellement",
"sActionPreviewHint": "aperçu",
"sActionRecordHint": "enregistrer",
"sActionShootHint": "prendre une photo",
"sActionShootingButtonTooltip": "bouton de prise de vue",
"sActionStopRecordingHint": "arrêter l'enregistrement",
"sCameraLensDirectionLabel": "Direction de la lentille de la caméra : {value}",
"sCameraPreviewLabel": "Aperçu de la caméra : {value}",
"sFlashModeLabel": "Mode flash : {mode}",
"sSwitchCameraLensDirectionLabel": "Passer à la caméra {value}"
}
19 changes: 18 additions & 1 deletion assets/l10n/intl_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -3080,5 +3080,22 @@
"unselect": "Отменить выбор",
"@unselect": {},
"searchContacts": "Поиск контактов",
"@searchContacts": {}
"@searchContacts": {},
"shootingTips": "Нажмите, чтобы сделать фото.",
"shootingWithRecordingTips": "Нажмите, чтобы сделать фото. Удерживайте для записи видео.",
"shootingOnlyRecordingTips": "Удерживайте для записи видео.",
"shootingTapRecordingTips": "Нажмите, чтобы записать видео.",
"loadFailed": "Не удалось загрузить",
"loading": "Загрузка...",
"saving": "Сохранение...",
"sActionManuallyFocusHint": "ручная фокусировка",
"sActionPreviewHint": "предпросмотр",
"sActionRecordHint": "запись",
"sActionShootHint": "сделать фото",
"sActionShootingButtonTooltip": "кнопка съемки",
"sActionStopRecordingHint": "остановить запись",
"sCameraLensDirectionLabel": "Направление объектива камеры: {value}",
"sCameraPreviewLabel": "Предпросмотр камеры: {value}",
"sFlashModeLabel": "Режим вспышки: {mode}",
"sSwitchCameraLensDirectionLabel": "Переключиться на камеру {value}"
}
26 changes: 25 additions & 1 deletion lib/presentation/mixins/common_media_picker_mixin.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:fluffychat/config/localizations/localization_service.dart';
import 'package:fluffychat/utils/localized_camera_picker_text_delegate.dart';
import 'package:fluffychat/utils/permission_dialog.dart';
import 'package:fluffychat/utils/permission_service.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -80,14 +82,36 @@ mixin CommonMediaPickerMixin {
context,
pickerConfig: onlyImage
? CameraPickerConfig(
textDelegate: getTextDelegateForLocale(
context,
),
enableAudio: false,
onError: (e, a) => _onError(context: context, error: e),
)
: CameraPickerConfig(
textDelegate: getTextDelegateForLocale(
context,
),
enableRecording: true,
onError: (e, a) => _onError(context: context, error: e),
),
locale: View.of(context).platformDispatcher.locale,
);
}

CameraPickerTextDelegate getTextDelegateForLocale(
BuildContext context,
) {
switch (LocalizationService.currentLocale.value.languageCode) {
case 'ru':
case 'fr':
return LocalizedCameraPickerTextDelegate(
context,
LocalizationService.currentLocale.value.languageCode,
);
default:
return cameraPickerTextDelegateFromLocale(
LocalizationService.currentLocale.value,
hoangdat marked this conversation as resolved.
Show resolved Hide resolved
);
}
}
nqhhdev marked this conversation as resolved.
Show resolved Hide resolved
}
80 changes: 80 additions & 0 deletions lib/utils/localized_camera_picker_text_delegate.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import 'package:flutter/material.dart';
import 'package:wechat_camera_picker/wechat_camera_picker.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';

class LocalizedCameraPickerTextDelegate extends CameraPickerTextDelegate {
final BuildContext context;
final String language;
const LocalizedCameraPickerTextDelegate(this.context, this.language);

@override
String get languageCode => language;

@override
String get confirm => L10n.of(context)!.confirm;

@override
String get shootingTips => L10n.of(context)!.shootingTips;

@override
String get shootingWithRecordingTips =>
L10n.of(context)!.shootingWithRecordingTips;

@override
String get shootingOnlyRecordingTips =>
L10n.of(context)!.shootingOnlyRecordingTips;

@override
String get shootingTapRecordingTips =>
L10n.of(context)!.shootingTapRecordingTips;

@override
String get loadFailed => L10n.of(context)!.loadFailed;

@override
String get loading => L10n.of(context)!.loading;

@override
String get saving => L10n.of(context)!.saving;

@override
String get sActionManuallyFocusHint =>
L10n.of(context)!.sActionManuallyFocusHint;

@override
String get sActionPreviewHint => L10n.of(context)!.sActionPreviewHint;

@override
String get sActionRecordHint => L10n.of(context)!.sActionRecordHint;

@override
String get sActionShootHint => L10n.of(context)!.sActionShootHint;

@override
String get sActionShootingButtonTooltip =>
L10n.of(context)!.sActionShootingButtonTooltip;

@override
String get sActionStopRecordingHint =>
L10n.of(context)!.sActionStopRecordingHint;

@override
String sCameraLensDirectionLabel(CameraLensDirection value) =>
L10n.of(context)!.sCameraLensDirectionLabel(value.name);

@override
String? sCameraPreviewLabel(CameraLensDirection? value) {
if (value == null) {
return null;
}
return L10n.of(context)!.sCameraPreviewLabel(value.name);
}

@override
String sFlashModeLabel(FlashMode mode) =>
L10n.of(context)!.sFlashModeLabel(mode.name);

@override
String sSwitchCameraLensDirectionLabel(CameraLensDirection value) =>
L10n.of(context)!.sSwitchCameraLensDirectionLabel(value.name);
}