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

Temporarily remove wbw translations #2170

Merged
merged 1 commit into from
Jun 13, 2024
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
12 changes: 12 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
makePagesLookupUrl,
makeNewSearchResultsUrl,
makeByRangeVersesUrl,
makeWordByWordTranslationsUrl,
} from '@/utils/apiPaths';
import { SearchRequest, AdvancedCopyRequest, PagesLookUpRequest } from 'types/ApiRequests';
import {
Expand Down Expand Up @@ -94,6 +95,17 @@ export const getRangeVerses = async (
export const getAvailableTranslations = async (language: string): Promise<TranslationsResponse> =>
fetcher(makeTranslationsUrl(language));

/**
* Get the current available wbw translations with the name translated in the current language.
*
* @param {string} language we use this to get translated names of authors in specific the current language.
*
* @returns {Promise<TranslationsResponse>}
*/
export const getAvailableWordByWordTranslations = async (
language: string,
): Promise<TranslationsResponse> => fetcher(makeWordByWordTranslationsUrl(language));

/**
* Get the current available languages with the name translated in the current language.
*
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/SettingsDrawer/WordByWordSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { logValueChange } from '@/utils/eventLogger';
import { getLocaleName } from '@/utils/locale';
import PreferenceGroup from 'types/auth/PreferenceGroup';

export const WBW_LOCALES = ['en', 'ur', 'id', 'bn', 'tr', 'fa', 'ru', 'hi', 'de', 'ta', 'inh'];
export const WBW_LOCALES = ['en', 'ur', 'id', 'bn', 'tr', 'fa', 'hi', 'ta', 'inh'];
export const WORD_BY_WORD_LOCALES_OPTIONS = WBW_LOCALES.map((locale) => ({
label: getLocaleName(locale),
value: locale,
Expand Down
9 changes: 9 additions & 0 deletions src/utils/apiPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ export const makeVersesFilterUrl = (params?: Record<string, unknown>) =>
export const makeTranslationsUrl = (language: string): string =>
makeUrl('/resources/translations', { language });

/**
* Compose the url for the wbw translations API.
*
* @param {string} language
* @returns {string}
*/
export const makeWordByWordTranslationsUrl = (language: string): string =>
makeUrl('/resources/word_by_word_translations', { language });

/**
* Compose the url for the languages API.
*
Expand Down
5 changes: 5 additions & 0 deletions types/ApiResponses.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import AudioData from './AudioData';
import AvailableLanguage from './AvailableLanguage';
import AvailableTranslation from './AvailableTranslation';
import AvailableWordByWordTranslation from './AvailableWordByWordTranslation';
import Chapter from './Chapter';
import ChapterInfo from './ChapterInfo';
import Footnote from './Footnote';
Expand Down Expand Up @@ -52,6 +53,10 @@ export interface TranslationsResponse extends BaseResponse {
translations?: AvailableTranslation[];
}

export interface WordByWordTranslationsResponse extends BaseResponse {
wordByWordTranslations?: AvailableWordByWordTranslation[];
}

export interface LanguagesResponse extends BaseResponse {
languages?: AvailableLanguage[];
}
Expand Down
6 changes: 6 additions & 0 deletions types/AvailableWordByWordTranslation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import AvailableTranslation from './AvailableTranslation';

interface AvailableWordByWordTranslation extends AvailableTranslation {
isoCode?: string;
}
export default AvailableWordByWordTranslation;
Loading