Skip to content

Commit

Permalink
fixed issue #1631
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel-C-Johnson committed Nov 23, 2023
1 parent ac6d090 commit c25d269
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
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

0 comments on commit c25d269

Please sign in to comment.