From c25d2698ef364917f674979217a104303493c056 Mon Sep 17 00:00:00 2001 From: Joel C Johnson Date: Thu, 23 Nov 2023 18:30:59 +0530 Subject: [PATCH] fixed issue #1631 --- public/build_number | 2 +- src/components/translatable/Translatable.js | 12 +++--------- src/components/translatable/TranslatableTSV.js | 10 ++++++---- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/public/build_number b/public/build_number index 79ca276e..3d6b7630 100644 --- a/public/build_number +++ b/public/build_number @@ -1 +1 @@ -273-2ccee8b +274-ac6d090 diff --git a/src/components/translatable/Translatable.js b/src/components/translatable/Translatable.js index 1deb4359..cb8f6464 100644 --- a/src/components/translatable/Translatable.js +++ b/src/components/translatable/Translatable.js @@ -55,32 +55,25 @@ function Translatable() { {' '} ); - // 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 = ; } 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) { @@ -106,6 +99,7 @@ function Translatable() { saveTranslation, autoSaveOnEdit, selectedFont, + targetRepository.full_name ]); useEffect(() => { diff --git a/src/components/translatable/TranslatableTSV.js b/src/components/translatable/TranslatableTSV.js index 570e3bca..804df879 100644 --- a/src/components/translatable/TranslatableTSV.js +++ b/src/components/translatable/TranslatableTSV.js @@ -58,6 +58,7 @@ export default function TranslatableTSV({ expandedScripture, cachedFile, selectedFont, + targetRepository, }, actions: { setResourceLinks }, giteaReactToolkit: { @@ -66,6 +67,8 @@ export default function TranslatableTSV({ }, } = useContext(AppContext); + const organizationName = targetRepository?.full_name.split('/')[0]?.toLowerCase(); + const { filepath: sourceFilepath, content: sourceContent, @@ -73,12 +76,11 @@ export default function TranslatableTSV({ } = 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 }, @@ -184,7 +186,7 @@ export default function TranslatableTSV({ ORIGINAL_LANG_POSITION={ORIGINAL_LANG_POSITION} >