From 0fe152b1efc61130ccb81587442b55986c237704 Mon Sep 17 00:00:00 2001 From: RanKKI Date: Mon, 17 Jun 2024 01:54:15 +1000 Subject: [PATCH] fix(mobile): translation for title (#10324) * fix(memory): translation for title * chore: update memoery translation for dutch * refactor(translation): avoid incompatibility with i18n website * fix: lint errors --- mobile/assets/i18n/en-US.json | 2 ++ mobile/assets/i18n/ja-JP.json | 2 ++ mobile/assets/i18n/nl-NL.json | 2 ++ mobile/assets/i18n/zh-CN.json | 2 ++ mobile/assets/i18n/zh-Hans.json | 2 ++ mobile/assets/i18n/zh-TW.json | 2 ++ mobile/lib/services/memory.service.dart | 8 +++++--- 7 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mobile/assets/i18n/en-US.json b/mobile/assets/i18n/en-US.json index e760a111b4..5f86e4064c 100644 --- a/mobile/assets/i18n/en-US.json +++ b/mobile/assets/i18n/en-US.json @@ -295,6 +295,8 @@ "memories_check_back_tomorrow": "Check back tomorrow for more memories", "memories_start_over": "Start Over", "memories_swipe_to_close": "Swipe up to close", + "memories_year_ago": "A year ago", + "memories_years_ago": "{} years ago", "monthly_title_text_date_format": "MMMM y", "motion_photos_page_title": "Motion Photos", "multiselect_grid_edit_date_time_err_read_only": "Cannot edit date of read only asset(s), skipping", diff --git a/mobile/assets/i18n/ja-JP.json b/mobile/assets/i18n/ja-JP.json index 075c6af859..8d935440af 100644 --- a/mobile/assets/i18n/ja-JP.json +++ b/mobile/assets/i18n/ja-JP.json @@ -295,6 +295,8 @@ "memories_check_back_tomorrow": "明日もう一度確認してください", "memories_start_over": "始める", "memories_swipe_to_close": "上にスワイプして閉じる", + "memories_year_ago": "過去1年間", + "memories_years_ago": "過去{}年間", "monthly_title_text_date_format": "yyyy年 MM月", "motion_photos_page_title": "モーションフォト", "multiselect_grid_edit_date_time_err_read_only": "読み取り専用の項目の日付を変更できません", diff --git a/mobile/assets/i18n/nl-NL.json b/mobile/assets/i18n/nl-NL.json index ba6d58eb56..6d2c36a986 100644 --- a/mobile/assets/i18n/nl-NL.json +++ b/mobile/assets/i18n/nl-NL.json @@ -295,6 +295,8 @@ "memories_check_back_tomorrow": "Kom morgen terug voor meer herinneringen", "memories_start_over": "Opnieuw beginnen", "memories_swipe_to_close": "Swipe omhoog om te sluiten", + "memories_year_ago": "1 jaar geleden", + "memories_years_ago": "{} jaar geleden", "monthly_title_text_date_format": "MMMM y", "motion_photos_page_title": "Bewegende foto's", "multiselect_grid_edit_date_time_err_read_only": "Kan datum van alleen-lezen asset(s) niet wijzigen, overslaan", diff --git a/mobile/assets/i18n/zh-CN.json b/mobile/assets/i18n/zh-CN.json index 805b7e40c7..cdddf657db 100644 --- a/mobile/assets/i18n/zh-CN.json +++ b/mobile/assets/i18n/zh-CN.json @@ -295,6 +295,8 @@ "memories_check_back_tomorrow": "明天再看", "memories_start_over": "再看一次", "memories_swipe_to_close": "上划关闭", + "memories_year_ago": "1年前", + "memories_years_ago": "{}年前", "monthly_title_text_date_format": "MMMM y", "motion_photos_page_title": "动图", "multiselect_grid_edit_date_time_err_read_only": "无法编辑只读项目的日期,跳过", diff --git a/mobile/assets/i18n/zh-Hans.json b/mobile/assets/i18n/zh-Hans.json index 0dffda78dd..06bc3e2cd1 100644 --- a/mobile/assets/i18n/zh-Hans.json +++ b/mobile/assets/i18n/zh-Hans.json @@ -295,6 +295,8 @@ "memories_check_back_tomorrow": "明天再看", "memories_start_over": "再看一次", "memories_swipe_to_close": "上划关闭", + "memories_year_ago": "1年前", + "memories_years_ago": "{}年前", "monthly_title_text_date_format": "MMMM y", "motion_photos_page_title": "动图", "multiselect_grid_edit_date_time_err_read_only": "无法编辑只读项目的日期,跳过", diff --git a/mobile/assets/i18n/zh-TW.json b/mobile/assets/i18n/zh-TW.json index e760a111b4..73ac8910f3 100644 --- a/mobile/assets/i18n/zh-TW.json +++ b/mobile/assets/i18n/zh-TW.json @@ -295,6 +295,8 @@ "memories_check_back_tomorrow": "Check back tomorrow for more memories", "memories_start_over": "Start Over", "memories_swipe_to_close": "Swipe up to close", + "memories_year_ago": "1年前", + "memories_years_ago": "{}年前", "monthly_title_text_date_format": "MMMM y", "motion_photos_page_title": "Motion Photos", "multiselect_grid_edit_date_time_err_read_only": "Cannot edit date of read only asset(s), skipping", diff --git a/mobile/lib/services/memory.service.dart b/mobile/lib/services/memory.service.dart index 613b6ed91e..ea07f7c019 100644 --- a/mobile/lib/services/memory.service.dart +++ b/mobile/lib/services/memory.service.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/models/memories/memory.model.dart'; @@ -8,8 +9,6 @@ import 'package:isar/isar.dart'; import 'package:logging/logging.dart'; import 'package:openapi/api.dart'; -import '../utils/string_helper.dart'; - final memoryServiceProvider = StateProvider((ref) { return MemoryService( ref.watch(apiServiceProvider), @@ -42,9 +41,12 @@ class MemoryService { final dbAssets = await _db.assets.getAllByRemoteId(assets.map((e) => e.id)); if (dbAssets.isNotEmpty) { + final String title = yearsAgo <= 1 + ? 'memories_year_ago'.tr() + : 'memories_years_ago'.tr(args: [yearsAgo.toString()]); memories.add( Memory( - title: '$yearsAgo year${s(yearsAgo)} ago', + title: title, assets: dbAssets, ), );