Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Source side shows Master file for Translation mode #1634

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/build_number
Original file line number Diff line number Diff line change
@@ -1 +1 @@
273-2ccee8b
274-ac6d090
12 changes: 3 additions & 9 deletions src/components/translatable/Translatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,25 @@ function Translatable() {
<CircularProgress />{' '}
</div>
);
// console.log("filepathsMatch=", filepathsMatch)
// console.log("sourceFileContent", sourceFileContent)
// console.log("releasedSourceContent", releasedSourceContent)
// console.log("targetFileContent", targetFileContent)
if (
filepathsMatch &&
(sourceFileContent || releasedSourceContent) &&
targetFileContent
) {
const organizationName = targetRepository?.full_name.split('/')[0]?.toLowerCase();
if (filepath.match(/\.md$/)) {

let translatableProps = {
original: sourceFileContent ? sourceFileContent : releasedSourceContent,
original: organizationName === "unfoldingword" ? sourceFileContent:releasedSourceContent,
translation: targetFileContent,
onTranslation: saveTranslation,
onContentIsDirty: setContentIsDirty,
translationFontFamily: selectedFont,
};
console.log('Markdown file selected');
_translatable = <MarkdownContextProvider><MarkDownTranslatable {...translatableProps} /></MarkdownContextProvider>;
} else if (filepath.match(/\.tsv$/)) {
console.log('TSV file selected');
const onSave = async function (...args) {
console.log("branch-merger: started saving");
const saved = await saveTranslation(...args);
console.log("branch-merger: finished saving");
return saved;
}
const onEdit = function (...args) {
Expand All @@ -106,6 +99,7 @@ function Translatable() {
saveTranslation,
autoSaveOnEdit,
selectedFont,
targetRepository.full_name
]);

useEffect(() => {
Expand Down
10 changes: 6 additions & 4 deletions src/components/translatable/TranslatableTSV.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default function TranslatableTSV({
expandedScripture,
cachedFile,
selectedFont,
targetRepository,
},
actions: { setResourceLinks },
giteaReactToolkit: {
Expand All @@ -66,19 +67,20 @@ export default function TranslatableTSV({
},
} = useContext(AppContext);

const organizationName = targetRepository?.full_name.split('/')[0]?.toLowerCase();

const {
filepath: sourceFilepath,
content: sourceContent,
publishedContent: releasedSourceContent,
} = sourceFileHook.state || {};
const { content: targetContent } = targetFileHook.state || {};
const { content: cachedContent } = cachedFile || {};
// console.log("TranslatableTSV() sourceContent, publishedContent:", sourceContent, releasedSourceContent)
const columnNames = useMemo(() => {
const _content = sourceContent || releasedSourceContent;
const _content = organizationName === "unfoldingword" ? sourceContent : releasedSourceContent;
const _columnNames = columnNamesFromContent({ content: _content, delimiters });
return _columnNames;
}, [sourceContent, releasedSourceContent]);
}, [sourceContent, releasedSourceContent, organizationName ]);

const {
actions: { onValidate },
Expand Down Expand Up @@ -184,7 +186,7 @@ export default function TranslatableTSV({
ORIGINAL_LANG_POSITION={ORIGINAL_LANG_POSITION}
>
<DataTable
sourceFile={sourceContent || releasedSourceContent}
sourceFile={organizationName === "unfoldingword" ? sourceContent : releasedSourceContent}
targetFile={cachedContent || targetContent}
onSave={onSave}
onEdit={onEdit}
Expand Down
Loading