Skip to content

adding translations to excel extractor and extractor plugin#738

Merged
elisadinsmore merged 6 commits intomainfrom
fix/addTranslations
Jan 30, 2025
Merged

adding translations to excel extractor and extractor plugin#738
elisadinsmore merged 6 commits intomainfrom
fix/addTranslations

Conversation

@elisadinsmore
Copy link
Contributor

Please explain how to summarize this PR for the Changelog:

Added translation keys for the excel extractor and extractor util

Tell code reviewer how and what to test:

When this is run with the accompanying Platform PR, the excel extraction process should be unchanged and the correct messages should be seen instead of translation keys.

@elisadinsmore
Copy link
Contributor Author

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

Walkthrough

The pull request introduces standardized error and logging message identifiers across three files: plugins/xlsx-extractor/src/parser.ts, utils/extractor/src/index.ts, and flatfilers/sandbox/src/index.ts. The changes replace descriptive text-based error messages and logging ticks with structured key references, improving consistency in error handling and logging across the codebase. Additionally, the ExcelExtractor is integrated into the listener's workflow without altering existing functionality. These modifications do not change the functional behavior of the code but enhance message management and potential internationalization support.

Changes

File Change Summary
plugins/xlsx-extractor/src/parser.ts - Replaced error message for file size limit from descriptive text to 'plugins.extraction.fileTooLarge'
- Updated workbook parsing error message to 'plugins.extraction.failedToParseWorkbook'
utils/extractor/src/index.ts - Updated logging tick messages to use structured identifiers:
* 'plugins.extraction.retrieveFile'
* 'plugins.extraction.parseSheets'
* 'plugins.extraction.createWorkbook'
* 'plugins.extraction.addingRecords'
- Modified error/outcome messages:
* 'plugins.extraction.noSheets'
* 'files.uploadFile.popovers.extractionCompleted'
* 'plugins.extraction.extractedFile'
flatfilers/sandbox/src/index.ts - Added listener.use(ExcelExtractor()) to integrate Excel extraction capability into the listener's workflow.

Possibly related PRs

  • fix: issue 1699 #729: The changes in this PR involve modifications to the header handling in the XLSX extraction process, which relates to the error handling updates in the parseBuffer function of the main PR, as both aim to improve the integrity and clarity of data processing in the XLSX extraction workflow.

Suggested reviewers

  • damonbanks

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8bdbbd and a23549f.

📒 Files selected for processing (1)
  • utils/extractor/src/index.ts (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • utils/extractor/src/index.ts
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Setup
  • GitHub Check: Nullify Dependencies

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
plugins/xlsx-extractor/src/parser.ts (2)

42-44: Convert debug log message to use translation key.

The error message has been converted to use a translation key, but the debug log message is still using a hardcoded string. For consistency, consider converting the debug message to use a translation key as well.

 if (options?.debug) {
-  console.log(
-    'File is too large to parse. Try converting this file to CSV.'
-  )
+  console.log('files.errors.fileTooLargeDebug')
 }

Line range hint 133-147: Standardize debug logging messages.

For consistency with the translation approach, consider converting these debug messages to use translation keys:

  • No rows found in '${sheetName}'
  • Detected header:
 if (debug) {
-  console.log(`No rows found in '${sheetName}'`)
+  console.log('files.extraction.noRowsFound', { sheetName })
 }
...
 if (debug) {
-  console.log('Detected header:', slicedHeader)
+  console.log('files.extraction.detectedHeader', { header: slicedHeader })
 }
utils/extractor/src/index.ts (2)

104-104: Consider using a constant for duplicate translation key.

The translation key 'files.extraction.addingRecords' is used in multiple places. Consider defining it as a constant to maintain consistency and make updates easier.

+const TRANSLATION_KEYS = {
+  ADDING_RECORDS: 'files.extraction.addingRecords'
+} as const;
...
-await tick(10, 'files.extraction.addingRecords')
+await tick(10, TRANSLATION_KEYS.ADDING_RECORDS)
...
-'files.extraction.addingRecords'
+TRANSLATION_KEYS.ADDING_RECORDS

Also applies to: 126-126


Line range hint 147-148: Convert debug log message to use translation key.

For consistency with other changes, consider converting the debug log message to use a translation key.

 if (debug) {
-  console.log(`Extractor error: ${e.message}`)
+  console.log('files.extraction.error', { message: e.message })
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1fa42b and 42c16d6.

📒 Files selected for processing (2)
  • plugins/xlsx-extractor/src/parser.ts (2 hunks)
  • utils/extractor/src/index.ts (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Setup
🔇 Additional comments (1)
utils/extractor/src/index.ts (1)

63-63: LGTM! Translation keys follow consistent patterns.

The translation keys follow consistent patterns:

  • Extraction-related keys: files.extraction.*
  • UI-related keys: files.uploadFile.popovers.*

Also applies to: 78-78, 86-86, 101-101, 141-141, 143-143, 154-154

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
flatfilers/sandbox/src/index.ts (1)

8-8: Ensure adequate testing of the newly integrated plugin

Invoking listener.use(ExcelExtractor()) seamlessly incorporates Excel file extraction into the pipeline. However, consider adding or extending integration tests to confirm that Excel files are extracted as expected and that no regressions occur with the existing JSONExtractor or export-delimited-zip plugin.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4c0158 and d6b8acf.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !**/*.json
📒 Files selected for processing (1)
  • flatfilers/sandbox/src/index.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Setup
  • GitHub Check: Nullify Dependencies
🔇 Additional comments (1)
flatfilers/sandbox/src/index.ts (1)

5-5: Good addition of the ExcelExtractor import

This import is essential for providing Excel file extraction functionality. Please ensure the dependency version in your package.json is aligned with your expected usage and that any related peer dependencies are satisfied.

@elisadinsmore elisadinsmore merged commit 40717d0 into main Jan 30, 2025
37 checks passed
@elisadinsmore elisadinsmore deleted the fix/addTranslations branch January 30, 2025 17:46
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.

3 participants