Skip to content

Fix: updated refresh message format and added missing UI labels#333

Open
Aryan-Singla wants to merge 4 commits intofossasia:mainfrom
Aryan-Singla:fix/refresh-text-and-ui-labels
Open

Fix: updated refresh message format and added missing UI labels#333
Aryan-Singla wants to merge 4 commits intofossasia:mainfrom
Aryan-Singla:fix/refresh-text-and-ui-labels

Conversation

@Aryan-Singla
Copy link
Copy Markdown

@Aryan-Singla Aryan-Singla commented Mar 2, 2026

For Issue :
Fixes #332

Description :

  • Updated the refresh mode message format to "WaveformName Selected".
  • Added missing "Text" label for the editor button.
  • Fixed incorrect label for imported images.

Summary by Sourcery

Improve localization coverage and refresh mode UX messaging across the image editor and l10n layer.

New Features:

  • Add localized strings for refresh mode information, including full and partial refresh descriptions, processing state, and long-press hint across all supported languages.

Bug Fixes:

  • Correct the waveform selection snackbar message to display in the format "WaveformName Selected".
  • Fix the editor action button to use the appropriate label for importing images instead of the previous incorrect label.

Enhancements:

  • Add a localized "Text" label to the editor/library UI in all supported locales.
  • Update multiple Hebrew and Hindi translations to more accurate, user-friendly localized text.
  • Simplify Norwegian Bokmål localization by consolidating support to a single locale variant and adjusting lookup accordingly.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Mar 2, 2026

Reviewer's Guide

Updates localization keys and strings to support new refresh mode messaging and missing UI labels, while cleaning up locale handling and aligning the image editor UI with the new text and import labels.

Class diagram for updated AppLocalizations hierarchy and new refresh mode labels

classDiagram
    class AppLocalizations {
      <<abstract>>
      +String appName
      +String aboutUsDescription
      +String library
      +String text
      +String processingImages
      +String refreshModeInfo
      +String fullRefreshInfo
      +String fullRefreshDescription
      +String partialRefreshInfo
      +String partialRefreshDescription
      +String longPressForInfo
      +String chooseImageFromGallery
    }

    class AppLocalizationsEn {
      +String appName
      +String library
      +String text
      +String processingImages
      +String refreshModeInfo
      +String fullRefreshInfo
      +String fullRefreshDescription
      +String partialRefreshInfo
      +String partialRefreshDescription
      +String longPressForInfo
    }

    class AppLocalizationsHe {
      +String developedBy
      +String fossasiaContributors
      +String aboutUs
      +String scanningForNfcTag
      +String rawPrefix
      +String recordPrefix
      +String rawPayloadLabel
      +String readOperationCompleted
      +String record
      +String recordsWritten
      +String recordsFound
      +String readNdefTags
      +String reading
      +String readNfcTag
      +String refreshNfcStatus
      +String readOperationFailed
      +String library
      +String text
      +String scanBarcode
      +String readyToFlash
      +String resultsCleared
      +String saveImagesFromEditor
      +String renameImage
      +String rename
      +String saveImage
      +String saveFilteredImageToLibrary
      +String renamingImage
      +String savingImage
      +String refreshingDisplay
      +String readNfcTags
      +String productImage
      +String productName
      +String quantitySize
      +String qrCodeData
      +String profilePhoto
      +String productDetails
      +String required
      +String productImageIn
      +String productImageSelected
      +String processingImages
      +String refreshModeInfo
      +String fullRefreshInfo
      +String fullRefreshDescription
      +String partialRefreshInfo
      +String partialRefreshDescription
      +String longPressForInfo
    }

    class AppLocalizationsHi {
      +String appName
      +String aboutUsDescription
      +String library
      +String text
      +String processingImages
      +String refreshModeInfo
      +String fullRefreshInfo
      +String fullRefreshDescription
      +String partialRefreshInfo
      +String partialRefreshDescription
      +String longPressForInfo
    }

    class AppLocalizationsNb {
      +String library
      +String text
      +String processingImages
      +String refreshModeInfo
      +String fullRefreshInfo
      +String fullRefreshDescription
      +String partialRefreshInfo
      +String partialRefreshDescription
      +String longPressForInfo
    }

    class AppLocalizationsNbNo {
      <<removed>>
    }

    class AppLocalizationsDe
    class AppLocalizationsEs
    class AppLocalizationsFr
    class AppLocalizationsId
    class AppLocalizationsJa
    class AppLocalizationsPt
    class AppLocalizationsRu
    class AppLocalizationsUk
    class AppLocalizationsVi
    class AppLocalizationsZh

    AppLocalizations <|-- AppLocalizationsEn
    AppLocalizations <|-- AppLocalizationsHe
    AppLocalizations <|-- AppLocalizationsHi
    AppLocalizations <|-- AppLocalizationsNb
    AppLocalizations <|-- AppLocalizationsDe
    AppLocalizations <|-- AppLocalizationsEs
    AppLocalizations <|-- AppLocalizationsFr
    AppLocalizations <|-- AppLocalizationsId
    AppLocalizations <|-- AppLocalizationsJa
    AppLocalizations <|-- AppLocalizationsPt
    AppLocalizations <|-- AppLocalizationsRu
    AppLocalizations <|-- AppLocalizationsUk
    AppLocalizations <|-- AppLocalizationsVi
    AppLocalizations <|-- AppLocalizationsZh
Loading

Class diagram for ImageEditor refresh mode message and bottom action labels

classDiagram
    class ImageEditor {
      +DisplayDevice device
    }

    class _ImageEditorState {
      -Waveform selectedWaveform
      +Widget build(BuildContext context)
      +void onWaveformSelected(Waveform waveform)
      +void showRefreshModeSnackBar(BuildContext context)
    }

    class BottomActionMenu {
      +ImgLoader imgLoader
      +Widget build(BuildContext context)
      +Widget _buildActionButton(BuildContext context, IconData icon, String label, Function onTap)
    }

    class AppLocalizations {
      +String fullRefreshSelected
      +String waveformSelected
      +String imported
    }

    class ScaffoldMessenger {
      +static ScaffoldMessenger of(BuildContext context)
      +void showSnackBar(SnackBar snackBar)
    }

    class SnackBar {
      +Widget content
      +Color backgroundColor
    }

    class Text {
      +Text(String data)
    }

    class Icons {
      <<static>>
      +IconData add_photo_alternate_outlined
    }

    ImageEditor --> _ImageEditorState
    _ImageEditorState --> AppLocalizations : uses
    _ImageEditorState --> ScaffoldMessenger : shows
    ScaffoldMessenger --> SnackBar : displays
    SnackBar --> Text : content

    BottomActionMenu --> AppLocalizations : uses
    BottomActionMenu --> Icons : uses

    _ImageEditorState : showRefreshModeSnackBar()
    _ImageEditorState : "if selectedWaveform == null use fullRefreshSelected"
    _ImageEditorState : "else use selectedWaveform.name + ' Selected'"

    BottomActionMenu : "label = appLocalizations.imported"
Loading

File-Level Changes

Change Details Files
Extended the localization API with new keys for text/editing and refresh mode information, and wired these into all supported locales.
  • Added a new text label getter in the base AppLocalizations class and implemented it across English, Hebrew, Hindi, and other locale-specific classes.
  • Introduced new getters for refresh mode info and processing state (processingImages, refreshModeInfo, fullRefreshInfo, fullRefreshDescription, partialRefreshInfo, partialRefreshDescription, longPressForInfo) in the base localizations and implemented them in each concrete locale.
  • Updated ARB/localization scaffolding in the core localization file to expose the new keys and documentation comments.
lib/l10n/app_localizations.dart
lib/l10n/app_localizations_en.dart
lib/l10n/app_localizations_he.dart
lib/l10n/app_localizations_hi.dart
lib/l10n/app_localizations_nb.dart
lib/l10n/app_localizations_de.dart
lib/l10n/app_localizations_es.dart
lib/l10n/app_localizations_fr.dart
lib/l10n/app_localizations_id.dart
lib/l10n/app_localizations_ja.dart
lib/l10n/app_localizations_pt.dart
lib/l10n/app_localizations_ru.dart
lib/l10n/app_localizations_uk.dart
lib/l10n/app_localizations_vi.dart
lib/l10n/app_localizations_zh.dart
lib/l10n/app_en.arb
Improved and corrected translations (especially Hebrew and Hindi) and fixed labels related to imported images and NFC operations.
  • Replaced several English placeholder strings in the Hebrew localization with proper Hebrew translations for NFC messages, records, image operations, product information, and workflow labels.
  • Updated the Hindi app name and about description to localized Hindi text.
  • Adjusted labels related to product images (productImage, productImageSelected) and QR/product details to ensure the imported image label reads correctly in the UI.
lib/l10n/app_localizations_he.dart
lib/l10n/app_localizations_hi.dart
lib/l10n/app_localizations_pt.dart
Simplified locale handling for Norwegian Bokmål by removing a redundant country-specific subclass and its registration.
  • Removed the Locale('nb', 'NO') entry from the supported locales list so only the generic nb locale is used.
  • Deleted the AppLocalizationsNbNo subclass and consolidated functionality into AppLocalizationsNb.
  • Updated the locale lookup switch to drop the special nb_NO case.
lib/l10n/app_localizations.dart
lib/l10n/app_localizations_nb.dart
Aligned the image editor UI with the new refresh mode message format and corrected the import button label.
  • Changed the waveform selection snackbar to display the selected waveform name followed by the word Selected instead of using the old localized waveformSelected prefix.
  • Swapped the bottom action menu label from import to imported to match the correct localization for imported images.
  • Performed minor formatting cleanup in image_editor.dart (removed unused import, fixed indentation).
lib/view/image_editor.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The updated waveform selection snackbar now hardcodes the "Selected" suffix instead of using a localized string; consider exposing a localization key for this pattern so the whole message remains translatable.
  • In the bottom action menu, the import button label was changed from appLocalizations.import to appLocalizations.imported, which reads like a past-tense status rather than an action; consider keeping or introducing an action-oriented localization key for this button.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The updated waveform selection snackbar now hardcodes the "Selected" suffix instead of using a localized string; consider exposing a localization key for this pattern so the whole message remains translatable.
- In the bottom action menu, the import button label was changed from `appLocalizations.import` to `appLocalizations.imported`, which reads like a past-tense status rather than an action; consider keeping or introducing an action-oriented localization key for this button.

## Individual Comments

### Comment 1
<location path="lib/view/image_editor.dart" line_range="436" />
<code_context>
                                             ? appLocalizations
                                                 .fullRefreshSelected
-                                            : "${appLocalizations.waveformSelected} ${_selectedWaveform!.name}",
+                                            : "${_selectedWaveform!.name} Selected",
                                       ),
                                       backgroundColor: colorPrimary,
</code_context>
<issue_to_address>
**issue (bug_risk):** Avoid hard‑coding the "Selected" suffix and use a localized string instead.

The previous implementation (`appLocalizations.waveformSelected`) kept this label fully localizable. With the hard‑coded "Selected" suffix, this chip will remain English in non‑English locales. Please either revert to the previous localized pattern (e.g. `"${appLocalizations.waveformSelected} ${_selectedWaveform!.name}"`) or introduce a parameterized localized string so both the waveform name and the "selected" text are translated.
</issue_to_address>

### Comment 2
<location path="lib/l10n/app_localizations_hi.dart" line_range="16" />
<code_context>
   @override
   String get aboutUsDescription =>
-      'Magic ePaper is an app designed to control and update ePaper displays. The goal is to provide tools for customizing and transferring images, text, and patterns to ePaper screens using NFC. Data transfer from the smartphone to the ePaper hardware is done wirelessly via NFC. The project is built on top of custom firmware and display drivers for seamless communication and efficient image rendering.';
+      'मैजिक ईपेपर एक ऐसा ऐप है जिसे ईपेपर डिस्प्ले को नियंत्रित और अपडेट करने के लिए डिज़ाइन किया गया है। इसका उद्देश्य एनएफसी का उपयोग करके ईपेपर स्क्रीन पर छवियों, टेक्स्ट और पैटर्न को अनुकूलित और स्थानांतरित करने के लिए उपकरण प्रदान करना है। स्मार्टफोन से ईपेपर हार्डवेयर में डेटा ट्रांसफर एनएफसी के माध्यम से वायरलेस तरीके से किया जाता है। यह प्रोजेक्ट निर्באध संचार और कुशल इमेज रेंडरिंग के लिए कस्टम फ़र्मवेयर और डिस्प्ले ड्राइवरों पर आधारित है।';

   @override
</code_context>
<issue_to_address>
**issue (typo):** The Hindi description string appears to contain mixed‑script characters (`निर्באध`).

`निर्באध` mixes Devanagari with (likely) Hebrew characters (`בא`), which will look wrong to users and is probably a copy/paste error. Please replace it with the correct Hindi word (e.g., `निरंतर`, `निर्बाध`, etc.) to avoid confusion.

Suggested implementation:

```
      'मैजिक ईपेपर एक ऐसा ऐप है जिसे ईपेपर डिस्प्ले को नियंत्रित और अपडेट करने के लिए डिज़ाइन किया गया है। इसका उद्देश्य एनएफसी का उपयोग करके ईपेपर स्क्रीन पर छवियों, टेक्स्ट और पैटर्न को अनुकूलित और स्थानांतरित करने के लिए उपकरण प्रदान करना है। स्मार्टफोन से ईपेपर हार्डवेयर में डेटा ट्रांसफर एनएफसी के माध्यम से वायरलेस तरीके से किया जाता है। यह प्रोजेक्ट निर्बाध संचार और कुशल इमेज रेंडरिंग के लिए कस्टम फ़र्मवेयर और डिस्प्ले ड्राइवरों पर आधारित है।';

```

The snippet shown includes duplicated declarations around `appName` and `aboutUsDescription` (an extra `String get aboutUsDescription =>` and `String get appName => 'मैजिक ईपेपर';`). If this reflects the real file, those duplicates should be cleaned up to avoid compilation issues.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread lib/view/image_editor.dart Outdated
@override
String get aboutUsDescription =>
'Magic ePaper is an app designed to control and update ePaper displays. The goal is to provide tools for customizing and transferring images, text, and patterns to ePaper screens using NFC. Data transfer from the smartphone to the ePaper hardware is done wirelessly via NFC. The project is built on top of custom firmware and display drivers for seamless communication and efficient image rendering.';
'मैजिक ईपेपर एक ऐसा ऐप है जिसे ईपेपर डिस्प्ले को नियंत्रित और अपडेट करने के लिए डिज़ाइन किया गया है। इसका उद्देश्य एनएफसी का उपयोग करके ईपेपर स्क्रीन पर छवियों, टेक्स्ट और पैटर्न को अनुकूलित और स्थानांतरित करने के लिए उपकरण प्रदान करना है। स्मार्टफोन से ईपेपर हार्डवेयर में डेटा ट्रांसफर एनएफसी के माध्यम से वायरलेस तरीके से किया जाता है। यह प्रोजेक्ट निर्באध संचार और कुशल इमेज रेंडरिंग के लिए कस्टम फ़र्मवेयर और डिस्प्ले ड्राइवरों पर आधारित है।';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): The Hindi description string appears to contain mixed‑script characters (निर्באध).

निर्באध mixes Devanagari with (likely) Hebrew characters (בא), which will look wrong to users and is probably a copy/paste error. Please replace it with the correct Hindi word (e.g., निरंतर, निर्बाध, etc.) to avoid confusion.

Suggested implementation:

      'मैजिक ईपेपर एक ऐसा ऐप है जिसे ईपेपर डिस्प्ले को नियंत्रित और अपडेट करने के लिए डिज़ाइन किया गया है। इसका उद्देश्य एनएफसी का उपयोग करके ईपेपर स्क्रीन पर छवियों, टेक्स्ट और पैटर्न को अनुकूलित और स्थानांतरित करने के लिए उपकरण प्रदान करना है। स्मार्टफोन से ईपेपर हार्डवेयर में डेटा ट्रांसफर एनएफसी के माध्यम से वायरलेस तरीके से किया जाता है। यह प्रोजेक्ट निर्बाध संचार और कुशल इमेज रेंडरिंग के लिए कस्टम फ़र्मवेयर और डिस्प्ले ड्राइवरों पर आधारित है।';

The snippet shown includes duplicated declarations around appName and aboutUsDescription (an extra String get aboutUsDescription => and String get appName => 'मैजिक ईपेपर';). If this reflects the real file, those duplicates should be cleaned up to avoid compilation issues.

@mariobehling mariobehling requested a review from Copilot April 13, 2026 00:17
@mariobehling
Copy link
Copy Markdown
Member

Thanks for the contribution!

A process note.

We have automatic Copilot PR reviews enabled on this repository. These reviews are only triggered if the contributor has GitHub Copilot enabled and an active license on their own account.

Please enable Copilot in your GitHub settings if you have access. In many regions, free licenses are available through educational institutions or developer programs. Enabling Copilot helps us speed up the auto review process and reduces manual review overhead for the core team.

Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the contribution. There are already AI reviews that point out issues. Please address them. If these are not relevant please reply to them.

@mariobehling
Copy link
Copy Markdown
Member

Please also add a screencast for your changes.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates image editor UX messaging and localization strings to make refresh-mode feedback consistent and to fill in missing UI labels.

Changes:

  • Standardized waveform selection snackbar message formatting to WaveformName Selected.
  • Added new localization keys (e.g., text, refresh-mode info strings, processingImages) and updated supported locale lookup for Norwegian Bokmål.
  • Updated UI labels in the image editor bottom action menu (import/editor/text).

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/view/image_editor.dart Updates refresh-mode snackbar text and bottom action menu labels (adds Text label).
lib/l10n/app_localizations.dart Adds new localization getters and removes nb_NO locale specialization from supported locales/lookup.
lib/l10n/app_localizations_zh.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_vi.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_uk.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_ru.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_pt.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_nb.dart Adds implementations for new localization getters and removes nb_NO subclass.
lib/l10n/app_localizations_ja.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_id.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_hi.dart Updates Hindi translations and adds implementations for new localization getters.
lib/l10n/app_localizations_he.dart Updates Hebrew translations and adds implementations for new localization getters.
lib/l10n/app_localizations_fr.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_es.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_en.dart Adds implementations for new localization getters.
lib/l10n/app_localizations_de.dart Adds implementations for new localization getters.
lib/l10n/app_en.arb Adds the text localization key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 433 to 437
_selectedWaveform == null
? appLocalizations
.fullRefreshSelected
: "${appLocalizations.waveformSelected} ${_selectedWaveform!.name}",
: "${_selectedWaveform!.name} Selected",
),
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The waveform selection snackbar message is now hard-coded ("${_selectedWaveform!.name} Selected"), which bypasses localization and makes it impossible to support languages where the word order differs. Use localized strings (e.g., a new ARB message with a {waveformName} placeholder, or at least combine with an existing localized "Selected" string) so this message can be translated consistently.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are made

Comment thread lib/view/image_editor.dart Outdated
context: context,
icon: Icons.add_photo_alternate_outlined,
label: appLocalizations.import,
label: appLocalizations.imported,
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This button triggers pickImage(...) (an import action), but the label uses appLocalizations.imported (past tense / source filter). This reads incorrectly before any import happens. Prefer the existing action label localization (e.g. importImageButtonLabel) or introduce a dedicated "Import" label key for this button.

Suggested change
label: appLocalizations.imported,
label: appLocalizations.importImageButtonLabel,

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes are made

@Aryan-Singla
Copy link
Copy Markdown
Author

I have made the required change here is evidence

Screen.Recording.2026-04-15.at.11.36.31.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When the user switches refresh mode, the inline error/status message at the bottom shows inconsistent word ordering.

3 participants