Skip to content

Commit

Permalink
🌐 Localized example (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Aug 1, 2023
1 parent 30ab550 commit 3307b67
Show file tree
Hide file tree
Showing 15 changed files with 705 additions and 56 deletions.
5 changes: 5 additions & 0 deletions example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include: ../analysis_options.yaml

analyzer:
exclude:
- lib/l10n/gen/*.dart
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
8 changes: 8 additions & 0 deletions example/l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
arb-dir: lib/l10n
# format: true
output-class: AppLocalizations
output-dir: lib/l10n/gen
output-localization-file: app_localizations.dart
template-arb-file: app_en.arb
synthetic-package: false
untranslated-messages-file: lib/l10n/gen/app_localizations_untranslated.json
11 changes: 11 additions & 0 deletions example/lib/extensions/l10n_extensions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2019 The FlutterCandies author. All rights reserved.
// Use of this source code is governed by an Apache license that can be found
// in the LICENSE file.

import 'package:flutter/widgets.dart';

import '../l10n/gen/app_localizations.dart';

extension BuildContextExtension on BuildContext {
AppLocalizations get l10n => AppLocalizations.of(this)!;
}
36 changes: 36 additions & 0 deletions example/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"@@locale": "en",
"appTitle": "WeChat Camera Picker Demo",
"appVersion": "Version: {version}",
"appVersionUnknown": "unknown",
"selectedAssetsText": "Selected Assets",
"pickMethodNotice": "Pickers in this page are located at the {dist}, defined by `pickMethods`.",
"pickMethodPhotosName": "Taking photos",
"pickMethodPhotosDescription": "Use cameras only to take photos.",
"pickMethodPhotosAndVideosName": "Taking photos and videos",
"pickMethodPhotosAndVideosDescription": "Use cameras to take photos and videos.",
"pickMethodVideosName": "Taking videos",
"pickMethodVideosDescription": "Use cameras only to take videos.",
"pickMethodVideosByTapName": "Taking videos by tap",
"pickMethodVideosByTapDescription": "Use cameras only to take videos, but not with long-press, just a single tap.",
"pickMethodSilenceRecordingName": "Silence recording",
"pickMethodSilenceRecordingDescription": "Make recordings silent.",
"pickMethodAutoPreviewVideosName": "Auto preview videos",
"pickMethodAutoPreviewVideosDescription": "Play videos automatically in the preview after captured.",
"pickMethodNoDurationLimitName": "No duration limit",
"pickMethodNoDurationLimitDescription": "Record as long as you with (if your device stays alive)...",
"pickMethodCustomizableThemeName": "Customizable theme (ThemeData)",
"pickMethodCustomizableThemeDescription": "Picking assets with the light theme or with a different color.",
"pickMethodRotateInTurnsName": "Rotate picker in turns",
"pickMethodRotateInTurnsDescription": "Rotate the picker layout in quarter turns, without the camera preview.",
"pickMethodPreventScalingName": "Prevent scaling for camera preview",
"pickMethodPreventScalingDescription": "Camera preview will not be scaled to cover the whole screen of the device, only fit for the raw aspect ratio.",
"pickMethodLowerResolutionName": "Lower resolutions",
"pickMethodLowerResolutionDescription": "Use a lower resolution preset might be helpful in some specific scenarios.",
"pickMethodPreferFrontCameraName": "Prefer front camera",
"pickMethodPreferFrontCameraDescription": "Use the front camera as the preferred lens direction if the device supports.",
"pickMethodPreferFlashlightOnName": "Prefer flashlight always on",
"pickMethodPreferFlashlightOnDescription": "Prefer to keep using the flashlight during captures.",
"pickMethodForegroundBuilderName": "Foreground builder",
"pickMethodForegroundBuilderDescription": "Build your widgets with the given CameraController on the top of the camera preview."
}
36 changes: 36 additions & 0 deletions example/lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"@@locale": "zh",
"appTitle": "WeChat Camera Picker 示例",
"appVersion": "版本:{version}",
"appVersionUnknown": "未知",
"selectedAssetsText": "已选的资源",
"pickMethodNotice": "该页面的所有选择器的代码位于 {dist},由 `pickMethods` 定义。",
"pickMethodPhotosName": "拍照",
"pickMethodPhotosDescription": "使用相机拍照。",
"pickMethodPhotosAndVideosName": "拍照和录像",
"pickMethodPhotosAndVideosDescription": "使用相机进行拍照和录像。",
"pickMethodVideosName": "录像",
"pickMethodVideosDescription": "使用相机录像。",
"pickMethodVideosByTapName": "轻触录像",
"pickMethodVideosByTapDescription": "轻触录像按钮进行录像,而不是长按。",
"pickMethodSilenceRecordingName": "静音录像",
"pickMethodSilenceRecordingDescription": "录像时不录制声音。",
"pickMethodAutoPreviewVideosName": "自动预览录制的视频",
"pickMethodAutoPreviewVideosDescription": "预览录制的视频时,自动播放。",
"pickMethodNoDurationLimitName": "无时长限制录像",
"pickMethodNoDurationLimitDescription": "想录多久,就录多久(只要手机健在)。",
"pickMethodCustomizableThemeName": "自定义主题 (ThemeData)",
"pickMethodCustomizableThemeDescription": "可以用亮色或其他颜色及自定义的主题进行选择。",
"pickMethodRotateInTurnsName": "旋转选择器的布局",
"pickMethodRotateInTurnsDescription": "顺时针旋转选择器的元素布局,不旋转相机视图。",
"pickMethodPreventScalingName": "禁止缩放相机预览",
"pickMethodPreventScalingDescription": "相机预览视图不会被放大到覆盖整个屏幕,仅适应原始的预览比例。",
"pickMethodLowerResolutionName": "低分辨率拍照",
"pickMethodLowerResolutionDescription": "某些情况或机型使用低分辨率拍照会有稳定性改善。",
"pickMethodPreferFrontCameraName": "首选前置摄像头",
"pickMethodPreferFrontCameraDescription": "在设备支持时首选使用前置摄像头。",
"pickMethodPreferFlashlightOnName": "首选闪光灯始终启用",
"pickMethodPreferFlashlightOnDescription": "在设备支持时首选闪光灯始终启用。",
"pickMethodForegroundBuilderName": "构建前景",
"pickMethodForegroundBuilderDescription": "通过 CameraController 构建在相机预览部分的前景 widget。"
}
Loading

0 comments on commit 3307b67

Please sign in to comment.