初始化提交
This commit is contained in:
Executable
+931
@@ -0,0 +1,931 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
/// 应用程序的翻译类
|
||||
class AppTranslations {
|
||||
/// 启动页翻译类
|
||||
static final KRSplashTranslations kr_splash = KRSplashTranslations();
|
||||
|
||||
/// 网络状态翻译类
|
||||
static final KRNetworkStatusTranslations kr_networkStatus =
|
||||
KRNetworkStatusTranslations();
|
||||
|
||||
/// 网络权限翻译类
|
||||
static final KRNetworkPermissionTranslations kr_networkPermission =
|
||||
KRNetworkPermissionTranslations();
|
||||
|
||||
/// 登录模块的翻译类
|
||||
static final AppTranslationsLogin kr_login = AppTranslationsLogin();
|
||||
|
||||
/// 主页模块的翻译类
|
||||
static final AppTranslationsHome kr_home = AppTranslationsHome();
|
||||
|
||||
/// 用户信息模块的翻译类
|
||||
static final AppTranslationsUserInfo kr_userInfo = AppTranslationsUserInfo();
|
||||
|
||||
/// 设置模块的翻译类
|
||||
static final AppTranslationsSetting kr_setting = AppTranslationsSetting();
|
||||
|
||||
/// 统计模块的翻译类
|
||||
static final AppTranslationsStatistics kr_statistics =
|
||||
AppTranslationsStatistics();
|
||||
|
||||
/// 邀请模块的翻译类
|
||||
static final AppTranslationsInvite kr_invite = AppTranslationsInvite();
|
||||
|
||||
/// 消息模块的翻译类
|
||||
static final AppTranslationsMessage kr_message = AppTranslationsMessage();
|
||||
|
||||
/// 套餐模块的翻译类
|
||||
static final AppTranslationsPurchaseMembership kr_purchaseMembership =
|
||||
AppTranslationsPurchaseMembership();
|
||||
|
||||
/// 订单状态模块的翻译类
|
||||
static final AppTranslationsOrderStatus kr_orderStatus =
|
||||
AppTranslationsOrderStatus();
|
||||
|
||||
/// 支付模块的翻译类
|
||||
static final AppTranslationsPayment kr_payment = AppTranslationsPayment();
|
||||
|
||||
/// 对话框模块的翻译类
|
||||
static final AppTranslationsDialog kr_dialog = AppTranslationsDialog();
|
||||
|
||||
/// 更新相关翻译
|
||||
static final KRUpdateTranslations kr_update = KRUpdateTranslations();
|
||||
|
||||
/// 国家相关翻译
|
||||
static final AppTranslationsCountry kr_country = AppTranslationsCountry();
|
||||
|
||||
/// 托盘相关翻译
|
||||
static final AppTranslationsTray kr_tray = AppTranslationsTray();
|
||||
|
||||
/// 初始化翻译
|
||||
static void kr_initTranslations() {
|
||||
// Get.addTranslations({
|
||||
// 'zh_CN': {
|
||||
// 'login.welcome': '欢迎使用',
|
||||
// 'login.verifyPhone': '验证手机号',
|
||||
// // ... 其他翻译键值对
|
||||
// },
|
||||
// 'en_US': {
|
||||
// 'login.welcome': 'Welcome',
|
||||
// 'login.verifyPhone': 'Verify Phone',
|
||||
// // ... 其他翻译键值对
|
||||
// }
|
||||
// });
|
||||
|
||||
// // 设置默认语言
|
||||
// Get.locale = const Locale('zh', 'CN');
|
||||
// // 设置备用语言
|
||||
// Get.fallbackLocale = const Locale('en', 'US');
|
||||
}
|
||||
|
||||
/// 切换语言
|
||||
static void kr_changeLanguage(String languageCode, String countryCode) {
|
||||
Get.updateLocale(Locale(languageCode, countryCode));
|
||||
}
|
||||
}
|
||||
|
||||
class AppTranslationsCountry {
|
||||
|
||||
String get cn => 'country.cn'.tr;
|
||||
String get ir => 'country.ir'.tr;
|
||||
String get af => 'country.af'.tr;
|
||||
String get ru => 'country.ru'.tr;
|
||||
String get tr => 'country.tr'.tr;
|
||||
String get br => 'country.br'.tr;
|
||||
String get id => 'country.id'.tr;
|
||||
|
||||
}
|
||||
|
||||
/// 登录模块的翻译类
|
||||
class AppTranslationsLogin {
|
||||
// Translations
|
||||
|
||||
/// 欢迎信息
|
||||
String get welcome => 'login.welcome'.tr;
|
||||
|
||||
/// 验证手机号
|
||||
String get verifyPhone => 'login.verifyPhone'.tr;
|
||||
|
||||
/// 验证邮箱
|
||||
String get verifyEmail => 'login.verifyEmail'.tr;
|
||||
|
||||
/// 发送验证码信息,动态传递账号参数
|
||||
/// [account] - 用户的账号信息
|
||||
String codeSent(String account) =>
|
||||
'login.codeSent'.trParams({'account': account});
|
||||
|
||||
/// 返回按钮文本
|
||||
String get back => 'login.back'.tr;
|
||||
|
||||
/// 输入邮箱或手机号提示
|
||||
String get enterEmailOrPhone => 'login.enterEmailOrPhone'.tr;
|
||||
|
||||
/// 输入验证码提示
|
||||
String get enterCode => 'login.enterCode'.tr;
|
||||
|
||||
/// 输入密码提示
|
||||
String get enterPassword => 'login.enterPassword'.tr;
|
||||
|
||||
/// 重新输入密码提示
|
||||
String get reenterPassword => 'login.reenterPassword'.tr;
|
||||
|
||||
/// 忘记密码提示
|
||||
String get forgotPassword => 'login.forgotPassword'.tr;
|
||||
|
||||
/// 验证码登录提示
|
||||
String get codeLogin => 'login.codeLogin'.tr;
|
||||
|
||||
/// 密码登录提示
|
||||
String get passwordLogin => 'login.passwordLogin'.tr;
|
||||
|
||||
/// 同意条款提示
|
||||
String get agreeTerms => 'login.agreeTerms'.tr;
|
||||
|
||||
/// 服务条款
|
||||
String get termsOfService => 'login.termsOfService'.tr;
|
||||
|
||||
/// 隐私政策
|
||||
String get privacyPolicy => 'login.privacyPolicy'.tr;
|
||||
|
||||
/// 下一步按钮文本
|
||||
String get next => 'login.next'.tr;
|
||||
|
||||
/// 立即注册按钮文本
|
||||
String get registerNow => 'login.registerNow'.tr;
|
||||
|
||||
/// 设置并登录按钮文本
|
||||
String get setAndLogin => 'login.setAndLogin'.tr;
|
||||
|
||||
/// 请输入账户提示
|
||||
String get enterAccount => 'login.enterAccount'.tr;
|
||||
|
||||
/// 密码不匹配提示
|
||||
String get passwordMismatch => 'login.passwordMismatch'.tr;
|
||||
|
||||
/// 发送验证码按钮文本
|
||||
String get sendCode => 'login.sendCode'.tr;
|
||||
|
||||
/// 验证码已发送倒计时文本
|
||||
String codeSentCountdown(int seconds) =>
|
||||
'login.codeSentCountdown'.trParams({'seconds': seconds.toString()});
|
||||
|
||||
/// 和
|
||||
String get and => 'login.and'.tr;
|
||||
|
||||
/// 邀请码输入提示
|
||||
String get enterInviteCode => 'login.enterInviteCode'.tr;
|
||||
|
||||
/// 注册成功提示
|
||||
String get registerSuccess => 'login.registerSuccess'.tr;
|
||||
}
|
||||
|
||||
class AppTranslationsHome {
|
||||
/// 欢迎信息
|
||||
String get welcome => 'home.welcome'.tr;
|
||||
|
||||
/// 连接状态
|
||||
String get disconnected => 'home.disconnected'.tr;
|
||||
String get connecting => 'home.connecting'.tr;
|
||||
String get connected => 'home.connected'.tr;
|
||||
String get disconnecting => 'home.disconnecting'.tr;
|
||||
|
||||
/// 当前连接
|
||||
String get currentConnectionTitle => 'home.currentConnectionTitle'.tr;
|
||||
String get switchNode => 'home.switchNode'.tr;
|
||||
String get timeout => 'home.timeout'.tr;
|
||||
String get upload => 'home.upload'.tr;
|
||||
String get download => 'home.download'.tr;
|
||||
|
||||
/// 加载状态
|
||||
String get loading => 'home.loading'.tr;
|
||||
String get error => 'home.error'.tr;
|
||||
String get checkNetwork => 'home.checkNetwork'.tr;
|
||||
String get retry => 'home.retry'.tr;
|
||||
|
||||
/// 连接区域
|
||||
String get connectionSectionTitle => 'home.connectionSectionTitle'.tr;
|
||||
String get dedicatedServers => 'home.dedicatedServers'.tr;
|
||||
String get countryRegion => 'home.countryRegion'.tr;
|
||||
|
||||
/// 服务器列表
|
||||
String get serverListTitle => 'home.serverListTitle'.tr;
|
||||
String get noServers => 'home.noServers'.tr;
|
||||
|
||||
/// 节点列表
|
||||
String get nodeListTitle => 'home.nodeListTitle'.tr;
|
||||
String get noNodes => 'home.noNodes'.tr;
|
||||
|
||||
/// 国家/地区列表
|
||||
String get countryListTitle => 'home.countryListTitle'.tr;
|
||||
String get noRegions => 'home.noRegions'.tr;
|
||||
|
||||
/// 订阅卡片
|
||||
String get subscriptionDescription => 'home.subscriptionDescription'.tr;
|
||||
String get subscribe => 'home.subscribe'.tr;
|
||||
|
||||
/// 试用相关
|
||||
String get trialPeriod => 'home.trialPeriod'.tr;
|
||||
String get remainingTime => 'home.remainingTime'.tr;
|
||||
String get trialExpired => 'home.trialExpired'.tr;
|
||||
String get subscriptionExpired => 'home.subscriptionExpired'.tr;
|
||||
|
||||
/// 订阅更新提示
|
||||
String get subscriptionUpdated => 'home.subscriptionUpdated'.tr;
|
||||
String get subscriptionUpdatedMessage => 'home.subscriptionUpdatedMessage'.tr;
|
||||
|
||||
/// 试用状态
|
||||
String get trialStatus => 'home.trialStatus'.tr;
|
||||
|
||||
/// 试用中
|
||||
String get trialing => 'home.trialing'.tr;
|
||||
|
||||
/// 试用结束提示
|
||||
String get trialEndMessage => 'home.trialEndMessage'.tr;
|
||||
|
||||
/// 最后一天订阅状态
|
||||
String get lastDaySubscriptionStatus => 'home.lastDaySubscriptionStatus'.tr;
|
||||
|
||||
/// 最后一天订阅提示
|
||||
String get lastDaySubscriptionMessage => 'home.lastDaySubscriptionMessage'.tr;
|
||||
|
||||
/// 订阅结束提示
|
||||
String get subscriptionEndMessage => 'home.subscriptionEndMessage'.tr;
|
||||
|
||||
/// 试用时间格式化(带天数)
|
||||
String trialTimeWithDays(int days, int hours, int minutes, int seconds) =>
|
||||
'home.trialTimeWithDays'.trParams({
|
||||
'days': days.toString(),
|
||||
'hours': hours.toString(),
|
||||
'minutes': minutes.toString(),
|
||||
'seconds': seconds.toString(),
|
||||
});
|
||||
|
||||
/// 试用时间格式化(带小时)
|
||||
String trialTimeWithHours(int hours, int minutes, int seconds) =>
|
||||
'home.trialTimeWithHours'.trParams({
|
||||
'hours': hours.toString(),
|
||||
'minutes': minutes.toString(),
|
||||
'seconds': seconds.toString(),
|
||||
});
|
||||
|
||||
/// 试用时间格式化(带分钟)
|
||||
String trialTimeWithMinutes(int minutes, int seconds) =>
|
||||
'home.trialTimeWithMinutes'.trParams({
|
||||
'minutes': minutes.toString(),
|
||||
'seconds': seconds.toString(),
|
||||
});
|
||||
|
||||
/// 延迟测试相关
|
||||
String get refreshLatency => 'home.refreshLatency'.tr;
|
||||
String get testLatency => 'home.testLatency'.tr;
|
||||
String get testing => 'home.testing'.tr;
|
||||
String get refreshLatencyDesc => 'home.refreshLatencyDesc'.tr;
|
||||
String get testAllNodesLatency => 'home.testAllNodesLatency'.tr;
|
||||
|
||||
/// 自动选择
|
||||
String get autoSelect => 'home.autoSelect'.tr;
|
||||
|
||||
/// 已选择
|
||||
String get selected => 'home.selected'.tr;
|
||||
|
||||
String get timeFormat => 'kr_time_format'.tr;
|
||||
}
|
||||
|
||||
class AppTranslationsUserInfo {
|
||||
// 用户信息页面相关翻译键
|
||||
|
||||
/// 页面标题
|
||||
String get title => 'userInfo.title'.tr;
|
||||
|
||||
/// 绑定提示
|
||||
String get bindingTip => 'userInfo.bindingTip'.tr;
|
||||
|
||||
/// 无有效订阅提示
|
||||
String get noValidSubscription => 'userInfo.noValidSubscription'.tr;
|
||||
|
||||
/// 立即订阅按钮文本
|
||||
String get subscribeNow => 'userInfo.subscribeNow'.tr;
|
||||
|
||||
/// 快捷键标题
|
||||
String get shortcuts => 'userInfo.shortcuts'.tr;
|
||||
|
||||
/// 广告拦截开关文本
|
||||
String get adBlock => 'userInfo.adBlock'.tr;
|
||||
|
||||
/// NDS解锁开关文本
|
||||
String get ndsUnlock => 'userInfo.dnsUnlock'.tr;
|
||||
|
||||
/// 联系我们文本
|
||||
String get contactUs => 'userInfo.contactUs'.tr;
|
||||
|
||||
/// 其他功能标题
|
||||
String get others => 'userInfo.others'.tr;
|
||||
|
||||
/// 退出登录按钮文本
|
||||
String get logout => 'userInfo.logout'.tr;
|
||||
|
||||
/// VPN官网入口文本
|
||||
String get vpnWebsite => 'userInfo.vpnWebsite'.tr;
|
||||
|
||||
/// 推特入口文本
|
||||
String get telegram => 'userInfo.telegram'.tr;
|
||||
|
||||
/// 邮箱入口文本
|
||||
String get mail => 'userInfo.mail'.tr;
|
||||
|
||||
/// 电话入口文本
|
||||
String get phone => 'userInfo.phone'.tr;
|
||||
|
||||
/// 人工客服支持入口文本
|
||||
String get customerService => 'userInfo.customerService'.tr;
|
||||
|
||||
/// 联系客服人员入口文本
|
||||
String get contactService => 'userInfo.contactService'.tr;
|
||||
|
||||
/// 我的账号
|
||||
String get myAccount => 'userInfo.myAccount'.tr;
|
||||
|
||||
/// 请先登录账号
|
||||
String get pleaseLogin => 'userInfo.pleaseLogin'.tr;
|
||||
|
||||
/// 订阅有效
|
||||
String get subscriptionValid => 'userInfo.subscriptionValid'.tr;
|
||||
|
||||
/// 开始时间
|
||||
String get startTime => 'userInfo.startTime'.tr;
|
||||
|
||||
/// 到期时间
|
||||
String get expireTime => 'userInfo.expireTime'.tr;
|
||||
|
||||
/// 立即登录
|
||||
String get loginNow => 'userInfo.loginNow'.tr;
|
||||
|
||||
/// 试用相关
|
||||
String get trialPeriod => 'userInfo.trialPeriod'.tr;
|
||||
String get remainingTime => 'userInfo.remainingTime'.tr;
|
||||
String get trialExpired => 'userInfo.trialExpired'.tr;
|
||||
String get subscriptionExpired => 'userInfo.subscriptionExpired'.tr;
|
||||
|
||||
/// 退出登录确认标题
|
||||
String get logoutConfirmTitle => 'userInfo.logoutConfirmTitle'.tr;
|
||||
|
||||
/// 退出登录确认消息
|
||||
String get logoutConfirmMessage => 'userInfo.logoutConfirmMessage'.tr;
|
||||
|
||||
/// 退出登录取消按钮文本
|
||||
String get logoutCancel => 'userInfo.logoutCancel'.tr;
|
||||
|
||||
/// 复制成功提示
|
||||
String get copySuccess => 'userInfo.copySuccess'.tr;
|
||||
|
||||
/// 暂无功能提示
|
||||
String get notAvailable => 'userInfo.notAvailable'.tr;
|
||||
|
||||
/// 将被删除
|
||||
String get willBeDeleted => 'userInfo.willBeDeleted'.tr;
|
||||
|
||||
/// 删除账号警告
|
||||
String get deleteAccountWarning => 'userInfo.deleteAccountWarning'.tr;
|
||||
|
||||
/// 请求删除
|
||||
String get requestDelete => 'userInfo.requestDelete'.tr;
|
||||
|
||||
String get switchSubscription => 'userInfo.switchSubscription'.tr;
|
||||
String get trafficUsage => 'userInfo.trafficUsage'.tr;
|
||||
String get deviceInfo => 'userInfo.deviceInfo'.tr;
|
||||
String get trafficProgressTitle => 'userInfo.trafficProgress.title'.tr;
|
||||
String get trafficProgressUnlimited => 'userInfo.trafficProgress.unlimited'.tr;
|
||||
String get trafficProgressLimited => 'userInfo.trafficProgress.limited'.tr;
|
||||
String get resetTraffic => 'userInfo.resetTraffic'.tr;
|
||||
String get resetTrafficSuccess => 'userInfo.resetTrafficSuccess'.tr;
|
||||
String get resetTrafficFailed => 'userInfo.resetTrafficFailed'.tr;
|
||||
|
||||
/// 设备限制
|
||||
String get deviceLimit => 'userInfo.deviceLimit'.tr;
|
||||
|
||||
/// 余额
|
||||
String get balance => 'userInfo.balance'.tr;
|
||||
|
||||
/// 重置
|
||||
String get reset => 'userInfo.reset'.tr;
|
||||
|
||||
/// 流量重置标题
|
||||
String get resetTrafficTitle => 'userInfo.resetTrafficTitle'.tr;
|
||||
|
||||
/// 流量重置消息
|
||||
/// [currentTime] - 当前到期时间
|
||||
/// [newTime] - 新的到期时间
|
||||
String resetTrafficMessage(String currentTime, String newTime) =>
|
||||
'userInfo.resetTrafficMessage'.trParams({
|
||||
'currentTime': currentTime,
|
||||
'newTime': newTime,
|
||||
});
|
||||
|
||||
final String download = '下载';
|
||||
final String upload = '上传';
|
||||
}
|
||||
|
||||
class AppTranslationsSetting {
|
||||
/// 设置页面标题
|
||||
String get title => 'setting.title'.tr;
|
||||
|
||||
/// VPN连接
|
||||
String get vpnConnection => 'setting.vpnConnection'.tr;
|
||||
|
||||
/// 通用
|
||||
String get general => 'setting.general'.tr;
|
||||
|
||||
/// 模式
|
||||
String get mode => 'setting.mode'.tr;
|
||||
|
||||
/// 自动连接
|
||||
String get autoConnect => 'setting.autoConnect'.tr;
|
||||
|
||||
/// 路由规则
|
||||
String get routeRule => 'setting.routeRule'.tr;
|
||||
|
||||
/// 选择国家
|
||||
String get countrySelector => 'setting.countrySelector'.tr;
|
||||
/// 选择国家描述
|
||||
String get connectionTypeRuleRemark => 'setting.connectionTypeRuleRemark'.tr;
|
||||
|
||||
/// 全局代理备注
|
||||
String get connectionTypeGlobalRemark => 'setting.connectionTypeGlobalRemark'.tr;
|
||||
|
||||
/// 直连备注
|
||||
String get connectionTypeDirectRemark => 'setting.connectionTypeDirectRemark'.tr;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// 外观
|
||||
String get appearance => 'setting.appearance'.tr;
|
||||
|
||||
/// 通知
|
||||
String get notifications => 'setting.notifications'.tr;
|
||||
|
||||
/// 帮助我们改进
|
||||
String get helpImprove => 'setting.helpImprove'.tr;
|
||||
|
||||
/// 帮助我们改进的副标题
|
||||
String get helpImproveSubtitle => 'setting.helpImproveSubtitle'.tr;
|
||||
|
||||
/// 请求删除账号
|
||||
String get requestDeleteAccount => 'setting.requestDeleteAccount'.tr;
|
||||
|
||||
/// 去删除
|
||||
String get goToDelete => 'setting.goToDelete'.tr;
|
||||
|
||||
/// 在 App Store 上为我们评分
|
||||
String get rateUs => 'setting.rateUs'.tr;
|
||||
|
||||
/// IOS评分
|
||||
String get iosRating => 'setting.iosRating'.tr;
|
||||
|
||||
/// 切换语言
|
||||
String get switchLanguage => 'setting.switchLanguage'.tr;
|
||||
|
||||
/// 系统
|
||||
String get system => 'setting.system'.tr;
|
||||
|
||||
/// 亮色
|
||||
String get light => 'setting.light'.tr;
|
||||
|
||||
/// 暗色
|
||||
String get dark => 'setting.dark'.tr;
|
||||
|
||||
/// 智能模式
|
||||
String get vpnModeSmart => 'setting.vpnModeSmart'.tr;
|
||||
|
||||
/// 全局
|
||||
String get connectionTypeGlobal => 'setting.connectionTypeGlobal'.tr;
|
||||
|
||||
/// 规则
|
||||
String get connectionTypeRule => 'setting.connectionTypeRule'.tr;
|
||||
|
||||
/// 直连
|
||||
String get connectionTypeDirect => 'setting.connectionTypeDirect'.tr;
|
||||
|
||||
/// 安全模式
|
||||
String get vpnModeSecure => 'setting.secureMode'.tr;
|
||||
|
||||
/// 版本
|
||||
String get version => 'setting.version'.tr;
|
||||
}
|
||||
|
||||
class AppTranslationsStatistics {
|
||||
/// 统计页面标题
|
||||
String get title => 'statistics.title'.tr;
|
||||
|
||||
/// VPN 状态
|
||||
String get vpnStatus => 'statistics.vpnStatus'.tr;
|
||||
|
||||
/// IP 地址
|
||||
String get ipAddress => 'statistics.ipAddress'.tr;
|
||||
|
||||
/// 连接时间
|
||||
String get connectionTime => 'statistics.connectionTime'.tr;
|
||||
|
||||
/// 协议
|
||||
String get protocol => 'statistics.protocol'.tr;
|
||||
|
||||
/// 每周保护时间
|
||||
String get weeklyProtectionTime => 'statistics.weeklyProtectionTime'.tr;
|
||||
|
||||
/// 当前连续记录
|
||||
String get currentStreak => 'statistics.currentStreak'.tr;
|
||||
|
||||
/// 最高记录
|
||||
String get highestStreak => 'statistics.highestStreak'.tr;
|
||||
|
||||
/// 最长连接时间
|
||||
String get longestConnection => 'statistics.longestConnection'.tr;
|
||||
|
||||
/// 天数
|
||||
String days(int days) =>
|
||||
'statistics.days'.trParams({'days': days.toString()});
|
||||
|
||||
/// 星期几
|
||||
String get monday => 'statistics.daysOfWeek.monday'.tr;
|
||||
String get tuesday => 'statistics.daysOfWeek.tuesday'.tr;
|
||||
String get wednesday => 'statistics.daysOfWeek.wednesday'.tr;
|
||||
String get thursday => 'statistics.daysOfWeek.thursday'.tr;
|
||||
String get friday => 'statistics.daysOfWeek.friday'.tr;
|
||||
String get saturday => 'statistics.daysOfWeek.saturday'.tr;
|
||||
String get sunday => 'statistics.daysOfWeek.sunday'.tr;
|
||||
}
|
||||
|
||||
class AppTranslationsInvite {
|
||||
/// 邀请页面标题
|
||||
String get title => 'invite.title'.tr;
|
||||
|
||||
/// 邀请进度
|
||||
String get progress => 'invite.progress'.tr;
|
||||
|
||||
/// 邀请统计
|
||||
String get inviteStats => 'invite.inviteStats'.tr;
|
||||
|
||||
/// 已注册
|
||||
String get registers => 'invite.registers'.tr;
|
||||
|
||||
/// 总佣金
|
||||
String get totalCommission => 'invite.totalCommission'.tr;
|
||||
|
||||
/// 奖励明细
|
||||
String get rewardDetails => 'invite.rewardDetails'.tr;
|
||||
|
||||
/// 邀请步骤
|
||||
String get steps => 'invite.steps'.tr;
|
||||
|
||||
/// 邀请好友
|
||||
String get inviteFriend => 'invite.inviteFriend'.tr;
|
||||
|
||||
/// 好友接受邀请
|
||||
String get acceptInvite => 'invite.acceptInvite'.tr;
|
||||
|
||||
/// 获得奖励
|
||||
String get getReward => 'invite.getReward'.tr;
|
||||
|
||||
/// 通过链接分享
|
||||
String get shareLink => 'invite.shareLink'.tr;
|
||||
|
||||
/// 通过二维码分享
|
||||
String get shareQR => 'invite.shareQR'.tr;
|
||||
|
||||
/// 邀请规则
|
||||
String get rules => 'invite.rules'.tr;
|
||||
|
||||
/// 规则1
|
||||
String get rule1 => 'invite.rule1'.tr;
|
||||
|
||||
/// 规则2
|
||||
String get rule2 => 'invite.rule2'.tr;
|
||||
|
||||
/// 待下载
|
||||
String get pending => 'invite.pending'.tr;
|
||||
|
||||
/// 在路上
|
||||
String get processing => 'invite.processing'.tr;
|
||||
|
||||
/// 已成功
|
||||
String get success => 'invite.success'.tr;
|
||||
|
||||
/// 已失效
|
||||
String get expired => 'invite.expired'.tr;
|
||||
|
||||
/// 我的邀请码
|
||||
String get myInviteCode => 'invite.myInviteCode'.tr;
|
||||
|
||||
/// 邀请码已复制到剪贴板
|
||||
String get inviteCodeCopied => 'invite.inviteCodeCopied'.tr;
|
||||
|
||||
/// 已复制到剪贴板
|
||||
String get copiedToClipboard => 'invite.copiedToClipboard'.tr;
|
||||
|
||||
/// 获取邀请码失败,请稍后重试
|
||||
String get getInviteCodeFailed => 'invite.getInviteCodeFailed'.tr;
|
||||
|
||||
/// 生成二维码失败,请稍后重试
|
||||
String get generateQRCodeFailed => 'invite.generateQRCodeFailed'.tr;
|
||||
|
||||
/// 生成分享链接失败,请稍后重试
|
||||
String get generateShareLinkFailed => 'invite.generateShareLinkFailed'.tr;
|
||||
|
||||
/// 关闭
|
||||
String get close => 'invite.close'.tr;
|
||||
}
|
||||
|
||||
class AppTranslationsMessage {
|
||||
/// 消息页面标题
|
||||
String get title => 'message.title'.tr;
|
||||
|
||||
/// 系统消息
|
||||
String get system => 'message.system'.tr;
|
||||
|
||||
/// 促销消息
|
||||
String get promotion => 'message.promotion'.tr;
|
||||
}
|
||||
|
||||
class AppTranslationsPurchaseMembership {
|
||||
/// 购买套餐
|
||||
String get purchasePackage => 'purchaseMembership.purchasePackage'.tr;
|
||||
|
||||
/// 暂无可用套餐
|
||||
String get noData => 'purchaseMembership.noData'.tr;
|
||||
|
||||
/// 我的账号
|
||||
String get myAccount => 'purchaseMembership.myAccount'.tr;
|
||||
|
||||
/// 选择套餐
|
||||
String get selectPackage => 'purchaseMembership.selectPackage'.tr;
|
||||
|
||||
/// 套餐描述
|
||||
String get packageDescription => 'purchaseMembership.packageDescription'.tr;
|
||||
|
||||
/// 支付方式
|
||||
String get paymentMethod => 'purchaseMembership.paymentMethod'.tr;
|
||||
|
||||
/// 您可以随时在APP上取消
|
||||
String get cancelAnytime => 'purchaseMembership.cancelAnytime'.tr;
|
||||
|
||||
/// 开始订阅
|
||||
String get startSubscription => 'purchaseMembership.startSubscription'.tr;
|
||||
|
||||
/// 立即续订
|
||||
String get renewNow => 'purchaseMembership.renewNow'.tr;
|
||||
|
||||
/// 流量限制
|
||||
String get trafficLimit => 'purchaseMembership.trafficLimit'.tr;
|
||||
|
||||
/// 设备限制
|
||||
String get deviceLimit => 'purchaseMembership.deviceLimit'.tr;
|
||||
|
||||
/// 套餐特性
|
||||
String get features => 'purchaseMembership.features'.tr;
|
||||
|
||||
/// 展开
|
||||
String get expand => 'purchaseMembership.expand'.tr;
|
||||
|
||||
/// 收起
|
||||
String get collapse => 'purchaseMembership.collapse'.tr;
|
||||
|
||||
/// 订阅和隐私信息
|
||||
String get subscriptionPrivacyInfo =>
|
||||
'purchaseMembership.subscriptionPrivacyInfo'.tr;
|
||||
|
||||
/// 动态月份
|
||||
String month(int months) =>
|
||||
'purchaseMembership.month'.trParams({'months': months.toString()});
|
||||
|
||||
/// 动态年份
|
||||
String year(int years) =>
|
||||
'purchaseMembership.year'.trParams({'years': years.toString()});
|
||||
|
||||
/// 动态天数
|
||||
String day(int days) =>
|
||||
'purchaseMembership.day'.trParams({'days': days.toString()});
|
||||
|
||||
/// 套餐详情
|
||||
String get planDetails => 'purchaseMembership.planDetails'.tr;
|
||||
|
||||
/// 套餐说明
|
||||
String get planDescription => 'purchaseMembership.planDescription'.tr;
|
||||
|
||||
/// 查看详情
|
||||
String get viewDetails => 'purchaseMembership.viewDetails'.tr;
|
||||
|
||||
/// 不限流量
|
||||
String get unlimitedTraffic => 'purchaseMembership.unlimitedTraffic'.tr;
|
||||
|
||||
/// 不限设备
|
||||
String get unlimitedDevices => 'purchaseMembership.unlimitedDevices'.tr;
|
||||
|
||||
/// 设备数量
|
||||
String devices(String count) =>
|
||||
'purchaseMembership.devices'.trParams({'count': count});
|
||||
|
||||
/// 确认购买
|
||||
String get confirmPurchase => 'purchaseMembership.confirmPurchase'.tr;
|
||||
|
||||
/// 确认购买描述
|
||||
String get confirmPurchaseDesc => 'purchaseMembership.confirmPurchaseDesc'.tr;
|
||||
}
|
||||
|
||||
/// 订单状态模块的翻译类
|
||||
class AppTranslationsOrderStatus {
|
||||
/// 订单状态标题
|
||||
String get title => 'orderStatus.title'.tr;
|
||||
|
||||
/// 待支付状态
|
||||
String get pendingTitle => 'orderStatus.pending.title'.tr;
|
||||
String get pendingDescription => 'orderStatus.pending.description'.tr;
|
||||
|
||||
/// 已支付状态
|
||||
String get paidTitle => 'orderStatus.paid.title'.tr;
|
||||
String get paidDescription => 'orderStatus.paid.description'.tr;
|
||||
|
||||
/// 支付成功状态
|
||||
String get successTitle => 'orderStatus.success.title'.tr;
|
||||
String get successDescription => 'orderStatus.success.description'.tr;
|
||||
|
||||
/// 订单关闭状态
|
||||
String get closedTitle => 'orderStatus.closed.title'.tr;
|
||||
String get closedDescription => 'orderStatus.closed.description'.tr;
|
||||
|
||||
/// 支付失败状态
|
||||
String get failedTitle => 'orderStatus.failed.title'.tr;
|
||||
String get failedDescription => 'orderStatus.failed.description'.tr;
|
||||
|
||||
/// 未知状态
|
||||
String get unknownTitle => 'orderStatus.unknown.title'.tr;
|
||||
String get unknownDescription => 'orderStatus.unknown.description'.tr;
|
||||
|
||||
/// 检查失败状态
|
||||
String get checkFailedTitle => 'orderStatus.checkFailed.title'.tr;
|
||||
String get checkFailedDescription => 'orderStatus.checkFailed.description'.tr;
|
||||
|
||||
/// 初始状态
|
||||
String get initialTitle => 'orderStatus.initial.title'.tr;
|
||||
String get initialDescription => 'orderStatus.initial.description'.tr;
|
||||
}
|
||||
|
||||
/// 支付模块的翻译类
|
||||
class AppTranslationsPayment {
|
||||
/// 支付标题
|
||||
String get title => 'payment.title'.tr;
|
||||
|
||||
/// 选择支付方式
|
||||
String get selectMethod => 'payment.selectMethod'.tr;
|
||||
|
||||
/// 支付宝
|
||||
String get alipay => 'payment.alipay'.tr;
|
||||
|
||||
/// 微信支付
|
||||
String get wechat => 'payment.wechat'.tr;
|
||||
|
||||
/// 信用卡
|
||||
String get creditCard => 'payment.creditCard'.tr;
|
||||
|
||||
/// PayPal
|
||||
String get paypal => 'payment.paypal'.tr;
|
||||
}
|
||||
|
||||
/// 翻译键常量
|
||||
class KRTranslationKeys {
|
||||
static const String kr_loginWelcome = 'login.welcome';
|
||||
static const String kr_loginVerifyPhone = 'login.verifyPhone';
|
||||
// ... 其他键定义
|
||||
}
|
||||
|
||||
/// 对话框模块的翻译类
|
||||
class AppTranslationsDialog {
|
||||
/// 确认按钮文本
|
||||
String get kr_confirm => 'dialog.confirm'.tr;
|
||||
|
||||
/// 取消按钮文本
|
||||
String get kr_cancel => 'dialog.cancel'.tr;
|
||||
|
||||
/// 确定按钮文本
|
||||
String get kr_ok => 'dialog.ok'.tr;
|
||||
|
||||
/// 我知道了按钮文本
|
||||
String get kr_iKnow => 'dialog.iKnow'.tr;
|
||||
}
|
||||
|
||||
/// 更新相关翻译
|
||||
class KRUpdateTranslations {
|
||||
/// 更新标题
|
||||
String get title => 'update.title'.tr;
|
||||
|
||||
/// 更新内容
|
||||
String get content => 'update.content'.tr;
|
||||
|
||||
/// 立即更新
|
||||
String get updateNow => 'update.updateNow'.tr;
|
||||
|
||||
/// 稍后更新
|
||||
String get updateLater => 'update.updateLater'.tr;
|
||||
|
||||
/// 默认更新内容
|
||||
String get defaultContent => 'update.defaultContent'.tr;
|
||||
}
|
||||
|
||||
/// 启动页翻译类
|
||||
class KRSplashTranslations {
|
||||
/// 应用名称
|
||||
String get appName => 'splash.appName'.tr;
|
||||
|
||||
/// 欢迎标语
|
||||
String get slogan => 'splash.slogan'.tr;
|
||||
|
||||
/// 初始化提示
|
||||
String get initializing => 'splash.initializing'.tr;
|
||||
|
||||
/// 网络连接失败提示
|
||||
String get kr_networkConnectionFailed => 'splash.networkConnectionFailure'.tr;
|
||||
|
||||
/// 重试按钮文本
|
||||
String get kr_retry => 'splash.retry'.tr;
|
||||
|
||||
/// 网络权限失败提示
|
||||
String get kr_networkPermissionFailed => 'splash.networkPermissionFailed'.tr;
|
||||
|
||||
/// 初始化失败提示
|
||||
String get kr_initializationFailed => 'splash.initializationFailed'.tr;
|
||||
}
|
||||
|
||||
/// 网络状态翻译类
|
||||
class KRNetworkStatusTranslations {
|
||||
/// 网络状态标题
|
||||
String get title => 'network.status.title'.tr;
|
||||
|
||||
/// 检查网络连接
|
||||
String get checkNetwork => 'network.status.checkNetwork'.tr;
|
||||
|
||||
/// 重试
|
||||
String get retry => 'network.status.retry'.tr;
|
||||
|
||||
/// 取消
|
||||
String get cancel => 'network.status.cancel'.tr;
|
||||
|
||||
/// 已连接
|
||||
String get connected => 'network.status.connected'.tr;
|
||||
|
||||
/// 已断开
|
||||
String get disconnected => 'network.status.disconnected'.tr;
|
||||
|
||||
/// 连接中
|
||||
String get connecting => 'network.status.connecting'.tr;
|
||||
|
||||
/// 断开中
|
||||
String get disconnecting => 'network.status.disconnecting'.tr;
|
||||
|
||||
/// 连接失败
|
||||
String get connectionFailed => 'network.status.connectionFailed'.tr;
|
||||
|
||||
/// 断开失败
|
||||
String get disconnectionFailed => 'network.status.disconnectionFailed'.tr;
|
||||
|
||||
/// 网络错误
|
||||
String get networkError => 'network.status.networkError'.tr;
|
||||
|
||||
/// 网络超时
|
||||
String get networkTimeout => 'network.status.networkTimeout'.tr;
|
||||
|
||||
/// 网络不可用
|
||||
String get networkUnavailable => 'network.status.networkUnavailable'.tr;
|
||||
|
||||
/// 网络可用
|
||||
String get networkAvailable => 'network.status.networkAvailable'.tr;
|
||||
}
|
||||
|
||||
/// 网络权限翻译类
|
||||
class KRNetworkPermissionTranslations {
|
||||
/// 网络权限标题
|
||||
String get title => 'network.permission.title'.tr;
|
||||
|
||||
/// 网络权限描述
|
||||
String get description => 'network.permission.description'.tr;
|
||||
|
||||
/// 去设置
|
||||
String get goToSettings => 'network.permission.goToSettings'.tr;
|
||||
|
||||
/// 取消
|
||||
String get cancel => 'network.permission.cancel'.tr;
|
||||
}
|
||||
|
||||
/// 托盘模块的翻译类
|
||||
class AppTranslationsTray {
|
||||
/// 打开仪表台
|
||||
String get openDashboard => 'tray.open_dashboard'.tr;
|
||||
|
||||
/// 复制到终端
|
||||
String get copyToTerminal => 'tray.copy_to_terminal'.tr;
|
||||
|
||||
/// 退出应用
|
||||
String get exitApp => 'tray.exit_app'.tr;
|
||||
}
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
// import 'package:get/get.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class GetxTranslations extends Translations {
|
||||
final Map<String, Map<String, String>> _translations = {};
|
||||
|
||||
@override
|
||||
Map<String, Map<String, String>> get keys => _translations;
|
||||
|
||||
// 初始化并加载所有翻译文件
|
||||
Future<void> loadAllTranslations() async {
|
||||
_translations['en'] = await _loadTranslations('assets/translations/strings_en.i18n.json');
|
||||
_translations['zh_CN'] = await _loadTranslations('assets/translations/strings_zh.i18n.json');
|
||||
_translations['zh_TW'] = await _loadTranslations('assets/translations/strings_zh_Hant.i18n.json');
|
||||
_translations['es'] =
|
||||
await _loadTranslations('assets/translations/strings_es.i18n.json');
|
||||
_translations['ja'] =
|
||||
await _loadTranslations('assets/translations/strings_ja.i18n.json');
|
||||
_translations['ru'] =
|
||||
await _loadTranslations('assets/translations/strings_ru.i18n.json');
|
||||
_translations['et'] =
|
||||
await _loadTranslations('assets/translations/strings_et.i18n.json');
|
||||
}
|
||||
|
||||
// 读取并解析 JSON 文件
|
||||
Future<Map<String, String>> _loadTranslations(String path) async {
|
||||
final Map<String, String> translations = {};
|
||||
final String jsonString = await rootBundle.loadString(path);
|
||||
final Map<String, dynamic> jsonMap = json.decode(jsonString);
|
||||
|
||||
_flattenTranslations(jsonMap, translations);
|
||||
|
||||
return translations;
|
||||
}
|
||||
|
||||
// 递归提取最底层的翻译文本并展平结构
|
||||
|
||||
void _flattenTranslations(
|
||||
Map<String, dynamic> jsonMap, Map<String, String> translations,
|
||||
[String prefix = '']) {
|
||||
jsonMap.forEach((key, value) {
|
||||
final newKey = prefix.isEmpty ? key : '$prefix.$key';
|
||||
if (value is Map<String, dynamic>) {
|
||||
_flattenTranslations(value, translations, newKey);
|
||||
} else if (value is String) {
|
||||
// 替换占位符 {xxx} 为 @xxx
|
||||
final modifiedValue = value.replaceAllMapped(
|
||||
RegExp(r'\{(\w+)\}'),
|
||||
(match) => '@${match.group(1)}',
|
||||
);
|
||||
translations[newKey] = modifiedValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Executable
+146
@@ -0,0 +1,146 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:kaer_with_panels/app/utils/kr_secure_storage.dart';
|
||||
|
||||
enum KRLanguage {
|
||||
en('🇬🇧', 'English', 'en'),
|
||||
zh('🇨🇳', '中文', 'zh'),
|
||||
es('🇪🇸', 'Español', 'es'),
|
||||
zhHant('🇹🇼', '繁體中文', 'zhHant'),
|
||||
ja('🇯🇵', '日本語', 'ja'),
|
||||
ru('🇷🇺', 'Русский', 'ru'),
|
||||
et('🇪🇪', 'Eesti', 'et');
|
||||
|
||||
final String flagEmoji;
|
||||
final String languageName;
|
||||
final String countryCode;
|
||||
|
||||
const KRLanguage(this.flagEmoji, this.languageName, this.countryCode);
|
||||
}
|
||||
|
||||
class KRLanguageUtils {
|
||||
static const String _lastLanguageKey = 'last_language';
|
||||
static const String _initLanguageKey = 'init_language';
|
||||
static final KRSecureStorage _storage = KRSecureStorage();
|
||||
static final RxString kr_language = ''.obs;
|
||||
// 获取可选语言列表
|
||||
|
||||
static List<KRLanguage> getAvailableLanguages() {
|
||||
return KRLanguage.values;
|
||||
}
|
||||
|
||||
// 切换语言
|
||||
static Future<void> switchLanguage(KRLanguage language) async {
|
||||
final locale = _getLocaleFromLanguage(language);
|
||||
|
||||
Get.updateLocale(locale);
|
||||
await _saveLastLanguage(language);
|
||||
kr_language.value = language.languageName;
|
||||
}
|
||||
|
||||
// 获取当前语言
|
||||
static KRLanguage getCurrentLanguage() {
|
||||
final locale = Get.locale;
|
||||
return _getLanguageFromLocale(locale);
|
||||
}
|
||||
|
||||
// 获取最后保存的语言并转换为 Locale
|
||||
static Future<Locale> getLastSavedLocale() async {
|
||||
final lastLanguage = await _storage.kr_readData(key: _lastLanguageKey);
|
||||
if (lastLanguage != null) {
|
||||
final language = KRLanguage.values.firstWhere(
|
||||
(lang) => lang.countryCode == lastLanguage,
|
||||
orElse: () => KRLanguage.ru,
|
||||
);
|
||||
return _getLocaleFromLanguage(language);
|
||||
}
|
||||
return Locale('ru');
|
||||
}
|
||||
|
||||
// 检查首次打开应用时的语言设置
|
||||
static Future<bool> checkInitialLanguage() async {
|
||||
final Locale? systemLocale = Get.deviceLocale;
|
||||
|
||||
final lastLanguage = await _storage.kr_readData(key: _initLanguageKey);
|
||||
if (lastLanguage == null) {
|
||||
final bool isChineseRegion = systemLocale?.languageCode == 'zh' &&
|
||||
(systemLocale?.countryCode == 'CN' ||
|
||||
systemLocale?.scriptCode == 'Hans');
|
||||
_storage.kr_saveData(
|
||||
key: _initLanguageKey, value: isChineseRegion.toString());
|
||||
return isChineseRegion;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 保存最后使用的语言
|
||||
static Future<void> _saveLastLanguage(KRLanguage language) async {
|
||||
await _storage.kr_saveData(
|
||||
key: _lastLanguageKey, value: language.countryCode);
|
||||
}
|
||||
|
||||
// 从语言枚举获取 Locale
|
||||
static Locale _getLocaleFromLanguage(KRLanguage language) {
|
||||
switch (language) {
|
||||
case KRLanguage.zh:
|
||||
return Locale('zh', 'CN');
|
||||
case KRLanguage.es:
|
||||
return Locale('es');
|
||||
case KRLanguage.zhHant:
|
||||
return Locale('zh', 'TW');
|
||||
case KRLanguage.ja:
|
||||
return Locale('ja');
|
||||
case KRLanguage.ru:
|
||||
return Locale('ru');
|
||||
case KRLanguage.et:
|
||||
return Locale('et');
|
||||
default:
|
||||
return Locale('en');
|
||||
}
|
||||
}
|
||||
|
||||
// 从 Locale 获取语言枚举
|
||||
static KRLanguage _getLanguageFromLocale(Locale? locale) {
|
||||
if (locale == null) return KRLanguage.en;
|
||||
switch (locale.languageCode) {
|
||||
case 'zh':
|
||||
if (locale.countryCode == 'TW' || locale.scriptCode == 'Hant') {
|
||||
return KRLanguage.zhHant;
|
||||
}
|
||||
return KRLanguage.zh;
|
||||
case 'es':
|
||||
return KRLanguage.es;
|
||||
case 'ja':
|
||||
return KRLanguage.ja;
|
||||
case 'ru':
|
||||
return KRLanguage.ru;
|
||||
case 'et':
|
||||
return KRLanguage.et;
|
||||
default:
|
||||
return KRLanguage.en;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取当前语言编码字符串
|
||||
static String getCurrentLanguageCode() {
|
||||
final KRLanguage currentLanguage = getCurrentLanguage();
|
||||
switch (currentLanguage) {
|
||||
case KRLanguage.zh:
|
||||
return 'zh_CN';
|
||||
case KRLanguage.zhHant:
|
||||
return 'zh_TW';
|
||||
case KRLanguage.es:
|
||||
return 'es';
|
||||
case KRLanguage.ja:
|
||||
return 'ja';
|
||||
case KRLanguage.ru:
|
||||
return 'ru';
|
||||
case KRLanguage.et:
|
||||
return 'et';
|
||||
case KRLanguage.en:
|
||||
return 'en';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user