Asset manager reports assets used only in a translation as not used

Đang mở Phù hợp với người mới
#2,376 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
angular, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu từ ProjectAssetService.calculateAssetUsage, hàm này tạo văn bản để tìm kiếm từ JSON.stringify(this.projectService.project) cộng với tên ảnh thu nhỏ và các tệp văn bản đang được sử dụng. Xem cách các tệp bản dịch (translations.<locale>.json) được tải trong dịch vụ dự án, và ComponentAuthoringComponent.setComponent để xem bản dịch được áp dụng lên một bản sao của nội dung như thế nào. Hoàn thành khi một asset chỉ được tham chiếu trong bản dịch không còn bị báo là không sử dụng; bạn có thể kiểm tra bằng unit test cho calculateAssetUsage có bao gồm một tệp bản dịch.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

ProjectAssetService.calculateAssetUsage decides whether an asset is used by searching JSON.stringify(this.projectService.project) (plus the thumbnail name and used text files). Translations are stored separately in translations.<locale>.json, and the authoring tool applies them only to a copy of each component's content (ComponentAuthoringComponent.setComponent), so the project object never contains translated text.

As a result, an asset referenced only in a translation, for example an image with labels in another language inserted through the translation editor, is marked "(Not Used)" in the asset manager, next to its delete button, and counted in the unused total. Deleting it breaks the translated unit.

This is from reading the code; I have not reproduced it in a running instance.

A fix would add the content of each of the project's translation files to the text searched in calculateAssetUsage.

Ngôn ngữ chính
TypeScript
Star
4
Fork
8
Merge trung bình
2 ngày 18 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của WISE-Community/WISE-Client

Tất cả issue của WISE-Community/WISE-Client

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.