Skip to content

Add USFM Upload and Validation to Existing Data Import #418

Description

@chadw-eten

Fluent currently only supports creating a project from scratch. Per DEC-N2, USFM is the v1 baseline import format for "create from existing data," with Scripture Burrito support following later. This ticket adds the parallel entry point on the project creation dialogue and the USFM upload flow itself; #361 had originally scoped this same entry point for Scripture Burrito but has not been built, so this ticket builds it directly rather than extending existing UI. Plain USFM has no package-level metadata, so Target Language cannot be parsed from the file and must be entered manually.

Functional Requirements

Project Creation Dialog

  • Add a new option, "Create from existing data," to the project creation screen, alongside "Start new project."
  • Convert the project creation dialog to a tabbed interface with two tabs: "New" and "Import."
  • The existing dialog content (the blank-project flow) moves into the "New" tab, unchanged.
  • The "Import" tab contains the USFM upload flow.

USFM Upload

  • Show a "Select File" button that opens a file picker for choosing USFM file(s).
  • Support dragging and dropping file(s) onto the upload area as an alternative to the "Select File" button.
  • Accept upload of one or more raw USFM files in a single action, one file per book.
    • Note: Multiple files is allowed so the new project can contain multiple books.
Image

Validation

  • Validate that each uploaded file parses as well-formed USFM.
  • If any file fails to parse (corrupt file, unrecognized structure), reject the entire import; do not perform a partial import.
  • Show the error message "File is not valid USFM" when validation fails.
  • Detect the book code for each file from its \id marker (3-letter USFM book code), falling back to \toc3 or \mt if \id is missing.
  • If a book code cannot be determined for a file, reject the import and show the error message "Missing book data."
  • Do not reject a file for containing USFM tags Fluent does not render or edit; store any such tag as passthrough data.
Image

Note: This ticket builds the entry point and upload flow originally scoped to #361, which has not been built. That ticket becomes the follow-on: it will extend this same upload handler with Scripture Burrito file-type detection rather than the other way around.
Note 2: Target Language selection is not part of this ticket's upload step; it's collected on the post-validation fields screen in #420.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

  • Status
    In PR Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions