Skip to content

Commit 3307b67

Browse files
authored
🌐 Localized example (#183)
1 parent 30ab550 commit 3307b67

15 files changed

+705
-56
lines changed

example/analysis_options.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include: ../analysis_options.yaml
2+
3+
analyzer:
4+
exclude:
5+
- lib/l10n/gen/*.dart

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

example/l10n.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
arb-dir: lib/l10n
2+
# format: true
3+
output-class: AppLocalizations
4+
output-dir: lib/l10n/gen
5+
output-localization-file: app_localizations.dart
6+
template-arb-file: app_en.arb
7+
synthetic-package: false
8+
untranslated-messages-file: lib/l10n/gen/app_localizations_untranslated.json
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2019 The FlutterCandies author. All rights reserved.
2+
// Use of this source code is governed by an Apache license that can be found
3+
// in the LICENSE file.
4+
5+
import 'package:flutter/widgets.dart';
6+
7+
import '../l10n/gen/app_localizations.dart';
8+
9+
extension BuildContextExtension on BuildContext {
10+
AppLocalizations get l10n => AppLocalizations.of(this)!;
11+
}

example/lib/l10n/app_en.arb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"@@locale": "en",
3+
"appTitle": "WeChat Camera Picker Demo",
4+
"appVersion": "Version: {version}",
5+
"appVersionUnknown": "unknown",
6+
"selectedAssetsText": "Selected Assets",
7+
"pickMethodNotice": "Pickers in this page are located at the {dist}, defined by `pickMethods`.",
8+
"pickMethodPhotosName": "Taking photos",
9+
"pickMethodPhotosDescription": "Use cameras only to take photos.",
10+
"pickMethodPhotosAndVideosName": "Taking photos and videos",
11+
"pickMethodPhotosAndVideosDescription": "Use cameras to take photos and videos.",
12+
"pickMethodVideosName": "Taking videos",
13+
"pickMethodVideosDescription": "Use cameras only to take videos.",
14+
"pickMethodVideosByTapName": "Taking videos by tap",
15+
"pickMethodVideosByTapDescription": "Use cameras only to take videos, but not with long-press, just a single tap.",
16+
"pickMethodSilenceRecordingName": "Silence recording",
17+
"pickMethodSilenceRecordingDescription": "Make recordings silent.",
18+
"pickMethodAutoPreviewVideosName": "Auto preview videos",
19+
"pickMethodAutoPreviewVideosDescription": "Play videos automatically in the preview after captured.",
20+
"pickMethodNoDurationLimitName": "No duration limit",
21+
"pickMethodNoDurationLimitDescription": "Record as long as you with (if your device stays alive)...",
22+
"pickMethodCustomizableThemeName": "Customizable theme (ThemeData)",
23+
"pickMethodCustomizableThemeDescription": "Picking assets with the light theme or with a different color.",
24+
"pickMethodRotateInTurnsName": "Rotate picker in turns",
25+
"pickMethodRotateInTurnsDescription": "Rotate the picker layout in quarter turns, without the camera preview.",
26+
"pickMethodPreventScalingName": "Prevent scaling for camera preview",
27+
"pickMethodPreventScalingDescription": "Camera preview will not be scaled to cover the whole screen of the device, only fit for the raw aspect ratio.",
28+
"pickMethodLowerResolutionName": "Lower resolutions",
29+
"pickMethodLowerResolutionDescription": "Use a lower resolution preset might be helpful in some specific scenarios.",
30+
"pickMethodPreferFrontCameraName": "Prefer front camera",
31+
"pickMethodPreferFrontCameraDescription": "Use the front camera as the preferred lens direction if the device supports.",
32+
"pickMethodPreferFlashlightOnName": "Prefer flashlight always on",
33+
"pickMethodPreferFlashlightOnDescription": "Prefer to keep using the flashlight during captures.",
34+
"pickMethodForegroundBuilderName": "Foreground builder",
35+
"pickMethodForegroundBuilderDescription": "Build your widgets with the given CameraController on the top of the camera preview."
36+
}

example/lib/l10n/app_zh.arb

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"@@locale": "zh",
3+
"appTitle": "WeChat Camera Picker 示例",
4+
"appVersion": "版本:{version}",
5+
"appVersionUnknown": "未知",
6+
"selectedAssetsText": "已选的资源",
7+
"pickMethodNotice": "该页面的所有选择器的代码位于 {dist},由 `pickMethods` 定义。",
8+
"pickMethodPhotosName": "拍照",
9+
"pickMethodPhotosDescription": "使用相机拍照。",
10+
"pickMethodPhotosAndVideosName": "拍照和录像",
11+
"pickMethodPhotosAndVideosDescription": "使用相机进行拍照和录像。",
12+
"pickMethodVideosName": "录像",
13+
"pickMethodVideosDescription": "使用相机录像。",
14+
"pickMethodVideosByTapName": "轻触录像",
15+
"pickMethodVideosByTapDescription": "轻触录像按钮进行录像,而不是长按。",
16+
"pickMethodSilenceRecordingName": "静音录像",
17+
"pickMethodSilenceRecordingDescription": "录像时不录制声音。",
18+
"pickMethodAutoPreviewVideosName": "自动预览录制的视频",
19+
"pickMethodAutoPreviewVideosDescription": "预览录制的视频时,自动播放。",
20+
"pickMethodNoDurationLimitName": "无时长限制录像",
21+
"pickMethodNoDurationLimitDescription": "想录多久,就录多久(只要手机健在)。",
22+
"pickMethodCustomizableThemeName": "自定义主题 (ThemeData)",
23+
"pickMethodCustomizableThemeDescription": "可以用亮色或其他颜色及自定义的主题进行选择。",
24+
"pickMethodRotateInTurnsName": "旋转选择器的布局",
25+
"pickMethodRotateInTurnsDescription": "顺时针旋转选择器的元素布局,不旋转相机视图。",
26+
"pickMethodPreventScalingName": "禁止缩放相机预览",
27+
"pickMethodPreventScalingDescription": "相机预览视图不会被放大到覆盖整个屏幕,仅适应原始的预览比例。",
28+
"pickMethodLowerResolutionName": "低分辨率拍照",
29+
"pickMethodLowerResolutionDescription": "某些情况或机型使用低分辨率拍照会有稳定性改善。",
30+
"pickMethodPreferFrontCameraName": "首选前置摄像头",
31+
"pickMethodPreferFrontCameraDescription": "在设备支持时首选使用前置摄像头。",
32+
"pickMethodPreferFlashlightOnName": "首选闪光灯始终启用",
33+
"pickMethodPreferFlashlightOnDescription": "在设备支持时首选闪光灯始终启用。",
34+
"pickMethodForegroundBuilderName": "构建前景",
35+
"pickMethodForegroundBuilderDescription": "通过 CameraController 构建在相机预览部分的前景 widget。"
36+
}

0 commit comments

Comments
 (0)