Skip to content

Commit

Permalink
Rcf021 (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsam authored Sep 5, 2024
2 parents 1357691 + 2390e06 commit a4e9745
Show file tree
Hide file tree
Showing 64 changed files with 2,765 additions and 2,759 deletions.
2 changes: 1 addition & 1 deletion reader/browsertest/basic_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def body(self):
self.click_sidebar_entry(section)
self.click_resources_on_sidebar()

self.click_sidebar_button("Compare Text")
self.click_sidebar_button("panel.compare_text")
self.driver.find_element_by_css_selector('.readerNavMenuMenuButton').click()

self.click_sidebar_button("Sheets")
Expand Down
14 changes: 7 additions & 7 deletions static/js/AboutBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class AboutBox extends Component {
if (d) {
detailSection = (<div className="detailsSection">
<h2 className="aboutHeader">
<span className={`${Sefaria.languageClassFont()}`}>{ Sefaria._("About This Text")}</span>
<span className={`${Sefaria.languageClassFont()}`}>{ Sefaria._("side_nav.about_text")}</span>
</h2>
<div className="aboutTitle">
{d.title.stripHtml()}
Expand All @@ -100,9 +100,9 @@ class AboutBox extends Component {
const translationVersions = Object.entries(this.state.currentVersionsByActualLangs).filter(([lang, version]) => lang !== "he").map(([lang, version])=> version);
const multiple_translations = translationVersions?.length > 1;
const no_source_versions = multiple_translations || translationVersions?.length === 1 && !sourceVersion;
const sourceVersionSectionTitle = {en: Sefaria._("Current Version"), he:Sefaria._("Current Version")};
const translationVersionsSectionTitle = multiple_translations ? {en: Sefaria._("Current Translations"), he:Sefaria._("Current Translations")} : {en: Sefaria._("Current Translation"), he: Sefaria._("Current Translation")};
const alternateVersionsSectionTitle = no_source_versions ? {en: Sefaria._("Source Versions"), he: Sefaria._("Source Versions")} : {en: Sefaria._("Alternate Source Versions"), he: Sefaria._("Alternate Source Versions")}
const sourceVersionSectionTitle = {en: Sefaria._("text.current_version"), he:Sefaria._("text.current_version")};
const translationVersionsSectionTitle = multiple_translations ? {en: Sefaria._("text.current_translation"), he:Sefaria._("text.current_translation")} : {en: Sefaria._("text.current_translation"), he: Sefaria._("text.current_translation")};
const alternateVersionsSectionTitle = no_source_versions ? {en: Sefaria._("source_versions"), he: Sefaria._("source_versions")} : {en: Sefaria._("alt_source_versions"), he: Sefaria._("alt_source_versions")}

let detailSection = null;
if (d) {
Expand Down Expand Up @@ -137,7 +137,7 @@ class AboutBox extends Component {
detailSection = (
<div className="detailsSection sans-serif">
<h2 className="aboutHeader">
<InterfaceText>{ Sefaria._("About This Text")}</InterfaceText>
<InterfaceText>side_nav.about_text</InterfaceText>
</h2>
<a href={bookPageUrl} className="aboutTitle serif">
<ContentText text={{en: d.title, he:d.heTitle}}/>
Expand All @@ -163,8 +163,8 @@ class AboutBox extends Component {

{ !!placeTextEn || !!dateTextEn ?
<div className="aboutComposed">
<span className="en">{ Sefaria._("Composed")} {`${!!placeTextEn ? placeTextEn : ""} ${!!dateTextEn ? dateTextEn : ""}`}</span>
<span className="he">{ Sefaria._("Composed")} {`${!!placeTextHe ? placeTextHe : ""} ${!!dateTextHe ? dateTextHe : ""}`}</span>
<span className="en">{ Sefaria._("text.composed")} {`${!!placeTextEn ? placeTextEn : ""} ${!!dateTextEn ? dateTextEn : ""}`}</span>
<span className="he">{ Sefaria._("text.composed")} {`${!!placeTextHe ? placeTextHe : ""} ${!!dateTextHe ? dateTextHe : ""}`}</span>
</div> : null
}
</div>
Expand Down
35 changes: 17 additions & 18 deletions static/js/AboutSheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => {
const newSummary = event.target.value
if (event.target.value.length > 280) {
setValidation({
validationMsg: Sefaria._("The summary description is limited to 280 characters."),
validationMsg: Sefaria._("summary_limit"),
validationFailed: "summary"
});
}
Expand Down Expand Up @@ -111,22 +111,22 @@ const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => {
const isFormValidated = () => {
if ((!summary || summary.trim() == '') && tags.length == 0) {
setValidation({
validationMsg: Sefaria._("Please add a description and topics to publish your sheet."),
validationMsg: Sefaria._("topic.add_desription"),
validationFailed: "both"
});
return false
}
else if (!summary || summary.trim() == '') {
setValidation({
validationMsg: Sefaria._("Please add a description to publish your sheet."),
validationMsg: Sefaria._("sheet.add_description"),
validationFailed: "summary"
});
return false
}

else if (tags.length == 0) {
setValidation({
validationMsg: Sefaria._("Please add topics to publish your sheet."),
validationMsg: Sefaria._("topic.add_topic_to_sheet"),
validationFailed: "topics"
});
return false
Expand Down Expand Up @@ -206,7 +206,7 @@ const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => {

{sheet.topics && sheet.topics.length > 0 ?
<div className="readings">
<h3 className="aboutSheetHeader"><InterfaceText>{ Sefaria._("Topics")}</InterfaceText></h3>
<h3 className="aboutSheetHeader"><InterfaceText>header.topic</InterfaceText></h3>
<div>
<ul className="aboutSheetLinks">
{sheet.topics.map((topic, i) => (
Expand All @@ -224,23 +224,23 @@ const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => {
</div>;

const publishSettingsEditMode = <div className="publishSettingsEditMode"><div className={isPublished ? "publishBox transparentBackground sans-serif" : "publishBox sans-serif"}>
{!isPublished ? <p><InterfaceText> { Sefaria._("Publish your sheet on Sefaria for others to discover.")}</InterfaceText></p> : null}
<h3 className="aboutSheetHeader"><InterfaceText> { Sefaria._("Summary")}</InterfaceText></h3>
{!isPublished ? <p><InterfaceText>sheet.publish_sheet_on_pecha</InterfaceText></p> : null}
<h3 className="aboutSheetHeader"><InterfaceText>summary</InterfaceText></h3>
<textarea
className={validation.validationFailed === "both" || validation.validationFailed === "summary" ? "error" : ""}
rows="3"
maxLength="281"
placeholder={Sefaria._("Write a short description of your sheet...")}
placeholder={Sefaria._("write_short_description")}
value={summary} onChange={handleSummaryChange}></textarea>
<h3 className="aboutSheetHeader"><InterfaceText>Topics</InterfaceText></h3>
<h3 className="aboutSheetHeader"><InterfaceText>header.topic</InterfaceText></h3>
<div className={validation.validationFailed === "both" || validation.validationFailed === "topics" ? "error" : ""}>
<ReactTags
ref={reactTags}
allowNew={true}
tags={tags}
suggestions={suggestions}
onDelete={onTagDelete}
placeholderText={Sefaria._("Add a topic...")}
placeholderText={Sefaria._("add_topic")}
delimiters={["Enter", "Tab", ","]}
onAddition={onTagAddition}
onValidate={onTagValidate}
Expand All @@ -251,7 +251,7 @@ const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => {

{!isPublished ? <div className={"publishButton"}>
<button className="button notPublished" onClick={togglePublish}>
<InterfaceText>{ Sefaria._("Publish")} </InterfaceText>
<InterfaceText>publish</InterfaceText>
</button>
</div> : null}

Expand All @@ -261,12 +261,11 @@ const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => {
<div className={"publishButton"}>
<div className="publishedText">
<InterfaceText>
<EnglishText>{Sefaria._("Your Sheet is")}<span className="publishedTextBold">{ Sefaria._("published")} </span> { Sefaria._("on Sefaria and visible to others through search and topics.")} </EnglishText>
<HebrewText>{Sefaria._("Your Sheet is")} <span className="publishedTextBold">{ Sefaria._("published")}</span> { Sefaria._("on Sefaria and visible to others through search and topics.")}</HebrewText>
{Sefaria._("sheet.your_sheet_is")}<span className="publishedTextBold">{ Sefaria._("published")} </span> { Sefaria._("topic.visible_to_other")}
</InterfaceText>
</div>
<button className="button published" onClick={togglePublish}>
<InterfaceText>{Sefaria._("Unpublish")}</InterfaceText>
<InterfaceText>unpublish</InterfaceText>
</button>
</div>
: null
Expand Down Expand Up @@ -295,10 +294,10 @@ const AboutSheet = ({ masterPanelSheetId, toggleSignUpModal }) => {
<div className="aboutSheetMetadata">
<div>
<span>{Sefaria.util.localeDate(sheet.dateCreated)}</span>
<span>{sheet.views} {Sefaria._("Views")}</span>
<span>{sheet.views} {Sefaria._("profile.tab.sheet.tag.views")}</span>
<span>{sheetSaves.length} {Sefaria._("Saves")}</span>
</div>
{/* {sheet.status !== 'public' ? (<div><span className="unlisted"><img src="/static/img/eye-slash.svg"/><span>{Sefaria._("Not Published")}</span></span></div>) : undefined} */}
{/* {sheet.status !== 'public' ? (<div><span className="unlisted"><img src="/static/img/eye-slash.svg"/><span>{Sefaria._("profile.tab.sheet.tag.not_published")}</span></span></div>) : undefined} */}
</div>
{
canEdit ? publishSettingsEditMode : publishSettingsReadOnly
Expand Down Expand Up @@ -417,14 +416,14 @@ const CollectionsEditor = ({ sheetId }) => {
{dataLoaded && collections.length === 0 ?
<span className={"emptyMessage"}>
<InterfaceText>
{Sefaria._("You can use collections to organize your sheets or public sheets you like. Collections can shared privately or made public on Sefaria.")}
{Sefaria._("profile.collection_description")}
</InterfaceText>
</span> : null}
</div>
<div className="collectionsEditorCreate">
<span className="collectionsWidgetPlus">+</span>
<div className="collectionsWidgetCreateInputBox">
<input className="collectionsWidgetCreateInput" placeholder={Sefaria._("Create new collection")} value={newName} onChange={onNameChange} />
<input className="collectionsWidgetCreateInput" placeholder={Sefaria._("collection.create_new_collection")} value={newName} onChange={onNameChange} />
</div>
{newName.length ?
<div className="button extraSmall white collectionsWidgetCreateButton" onClick={onCreateClick}>
Expand Down
26 changes: 13 additions & 13 deletions static/js/AddToSourceSheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class AddToSourceSheetBox extends Component {
setDefaultSheet() {
if (this.state.selectedSheet) { return; }
if (!Sefaria._uid) {
this.setState({selectedSheet: {title: Sefaria._( "Your Sheet")}});
this.setState({selectedSheet: {title: Sefaria._( "sheet.your_sheet")}});
} else {
var sheets = Sefaria.sheets.userSheets(Sefaria._uid);
if (!sheets.length) {
this.setState({selectedSheet: {title: Sefaria._( "Create a New Sheet")}});
this.setState({selectedSheet: {title: Sefaria._( "header.profileMenu.create_New_Sheet")}});
} else {
this.setState({selectedSheet: sheets[0]});
}
Expand Down Expand Up @@ -133,7 +133,7 @@ class AddToSourceSheetBox extends Component {
for (let i = 0; i < refs.length; i++) {
let ref = Sefaria.getRefFromCache(refs[i]);
if (ref && (Sefaria.isFullSegmentImage(ref.he) || Sefaria.isFullSegmentImage(ref.text))) {
alert(Sefaria._( "We do not currently support adding images to source sheets."));
alert(Sefaria._( "sheet.message.do_not_support_adding_images_to_source_sheets"));
return false;
}
}
Expand Down Expand Up @@ -178,8 +178,8 @@ class AddToSourceSheetBox extends Component {
disallowedTagsMode: 'discard',
});
let titleRetval = {
"en": `${sheetTitle} ${Sefaria._("Section")}${nodeID}`,
"he": `${sheetTitle} ${Sefaria._("Section")}${nodeID}`
"en": `${sheetTitle} ${Sefaria._("section")}${nodeID}`,
"he": `${sheetTitle} ${Sefaria._("section")}${nodeID}`
}
if (refTitles){ //show the refs also of a source, just to be nice
titleRetval["en"] += `(${refTitles["en"]})`;
Expand All @@ -202,7 +202,7 @@ class AddToSourceSheetBox extends Component {
const sheets = Sefaria._uid ? Sefaria.sheets.userSheets(Sefaria._uid) : null;
let sheetsList = Sefaria._uid && sheets ? sheets.map((sheet) => {
let classes = classNames({dropdownOption: 1, noselect: 1, selected: this.state.selectedSheet && this.state.selectedSheet.id === sheet.id});
let title = sheet.title ? sheet.title.stripHtml() : Sefaria._("Untitled Source Sheet");
let title = sheet.title ? sheet.title.stripHtml() : Sefaria._("sheet.untitled_sourc_sheet");
let selectSheet = this.selectSheet.bind(this, sheet);
return (<div className={classes} onClick={selectSheet} key={sheet.id}>{title}</div>);
}) : (Sefaria._uid ? <LoadingMessage /> : null);
Expand All @@ -218,11 +218,11 @@ class AddToSourceSheetBox extends Component {
<span className="he">{titleRef["he"]}</span>
</div>
<div className="addToSourceSheetBoxTitle sans-serif">
<span className={`${Sefaria.languageClassFont()}`}>{ Sefaria._("Add to")} </span>
<span className={`${Sefaria.languageClassFont()}`}>{ Sefaria._("sheet.add_to")} </span>
</div>
<div className="dropdown">
<div className={`dropdownMain noselect ${this.state.sheetListOpen ? "open" : ""}`} onClick={this.toggleSheetList}>
{this.state.sheetsLoaded ? (this.state.selectedSheet.title === null ? Sefaria._("Untitled Source Sheet") : this.state.selectedSheet.title.stripHtml()) : <LoadingMessage messsage={Sefaria._("Loading your sheets")} heMessage={Sefaria._("Loading your sheets")}/>} </div>
{this.state.sheetsLoaded ? (this.state.selectedSheet.title === null ? Sefaria._("sheet.untitled_sourc_sheet") : this.state.selectedSheet.title.stripHtml()) : <LoadingMessage messsage={Sefaria._("sheet.loading_sheet")} heMessage={Sefaria._("sheet.loading_sheet")}/>} </div>
{this.state.sheetListOpen ?
<div className="dropdownListBox noselect">
<div className="dropdownList noselect">
Expand All @@ -238,7 +238,7 @@ class AddToSourceSheetBox extends Component {
: null}
</div>
<div className="button noselect fillWidth" onClick={this.props.nodeRef ? this.copyNodeToSourceSheet : this.addToSourceSheet}>
<span className={`${Sefaria.languageClassFont()} noselect`}>{ Sefaria._("Add to Sheet")}</span>
<span className={`${Sefaria.languageClassFont()} noselect`}>{ Sefaria._("sheet.add_to_sheet")}</span>
</div>
</div>);
}
Expand Down Expand Up @@ -269,15 +269,15 @@ class ConfirmAddToSheet extends Component {
disallowedTagsMode: 'discard',
});
srefTitles = {
"en": `${Sefaria._("Section from")} "${sheetTitle}"`,
"he": `${Sefaria._("Section from")} "${sheetTitle}"`,
"en": `${Sefaria._("sheet.section_from")} "${sheetTitle}"`,
"he": `${Sefaria._("sheet.section_from")} "${sheetTitle}"`,
};
}
return (<div className="confirmAddToSheet addToSourceSheetBox">
<div className="message">
<span className={`${Sefaria.languageClassFont()}`}>
<a href={sref}>{srefTitles["he"]}</a>
&nbsp;{Sefaria._("has been added to")}&nbsp;
&nbsp;{Sefaria._("sheet.has_been_added_to")}&nbsp;
<a href={"/sheets/" + this.props.sheet.id} target="_blank">{this.props.sheet.title}</a>.
</span>
</div>
Expand All @@ -304,7 +304,7 @@ class AddToSourceSheetWindow extends Component {
<div className="sourceSheetBoxTitle">
<img src="/static/icons/circled-x.svg" className="closeButton" aria-hidden="true" alt="Close" onClick={this.close}/>
{Sefaria._uid ? null : <span>
{Sefaria._("In order to add this source to a sheet, please ")} <a href={"/login" + nextParam}> {Sefaria._("log in")} </a>
{Sefaria._("sheet.message.login_before_add_source_sheet")} <a href={"/login" + nextParam}> {Sefaria._("log_in")} </a>
</span>}
<div className="clearFix"></div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions static/js/AdminEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ const options_for_form = {
"English Description": {
label: "English Description",
field: "enDescription",
placeholder: "Add a description.",
placeholder: Sefaria._("topic.admin.description"),
type: 'textarea',
markdown: true,
},
"Hebrew Description": {
label: "Tibetan Description",
field: "heDescription",
placeholder: "Add a description.",
placeholder: Sefaria._("topic.admin.description"),
type: 'textarea',
markdown: true
},
"Prompt": {label: "Prompt", field: "prompt", placeholder: "Add a prompt.", type: 'textarea'},
"English Short Description": {
label: "English Short Description for Table of Contents", field: "enCategoryDescription",
placeholder: "Add a short description.", type: 'input'
label: Sefaria._("topic.admin.en_short_description"), field: "enCategoryDescription",
placeholder: Sefaria._("topic.admin.short_description"), type: 'input'
},
"Hebrew Short Description": {
label: "Tibetan Short Description for Table of Contents", field: "heCategoryDescription",
placeholder: "Add a short description.", type: 'input'
label: Sefaria._("topic.admin.bo_short_description"), field: "heCategoryDescription",
placeholder: Sefaria._("topic.admin.short_description"), type: 'input'
},
"English Alternate Titles": {
label: "English Alternate Titles", field: "enAltTitles",
Expand Down
Loading

0 comments on commit a4e9745

Please sign in to comment.