ROAR DocumentationROAR Documentation
  • Databases
  • Workflows
  • Application
  • GitHub Actions
  • Dashboard Components
  • Firebase App Check
  • Cloud Functions
  • Backend Architecture
  • Internationalization
  • Integrating New Apps
  • Optimizing Assets
  • ROAR Redivis Instance
  • Logging and Querying
  • Emulation
  • Data Guidelines
  • Data Organization
  • Data Requests
GitHub
  • Databases
  • Workflows
  • Application
  • GitHub Actions
  • Dashboard Components
  • Firebase App Check
  • Cloud Functions
  • Backend Architecture
  • Internationalization
  • Integrating New Apps
  • Optimizing Assets
  • ROAR Redivis Instance
  • Logging and Querying
  • Emulation
  • Data Guidelines
  • Data Organization
  • Data Requests
GitHub
  • Databases
    • Database Information
    • gse-roar-admin
    • gse-roar-assessment
  • BigQuery
    • Querying Assessment Data
    • BigQuery schema: classes
    • BigQuery schema: districts
    • BigQuery schema: families
    • BigQuery schema: groups
    • BigQuery schema: schools
    • BigQuery schema: user_runs
    • BigQuery schema: user_trials
    • BigQuery schema: users
  • Workflows
    • Workflows
    • Creating an Assignment
    • Authentication
    • Creating new Users
    • User Roster Changes
    • How to Impersonate a Clever User on Localhost
  • Application

    • Auth
  • GitHub Actions
    • ROAR Apps GitHub Actions
      • GitHub Actions in ROAR Apps
      • firebase-deploy-preview.yml
      • firebase-hosting-merge.yml
      • publish-to-npm-create-new-release.yml
      • submit-dashboard-pr.yml
    • ROAR Dashboard GitHub Actions
      • GitHub Actions in the ROAR Dashboard
  • Dashboard Components
    • Dashboard Components
    • Organization Score Reports
  • Firebase App Check
    • Firebase App Check Configuration for roar-firekit and roar-dashboard
  • Backend Architecture
    • Architecture
      • Backend Architecture in ROAR
      • Data Models
      • Database Implementations
      • Error Handling Architecture in ROAR
      • Repository Layer Architecture
      • Service Layer Architecture
    • API
      • Classes
        • Class: AdministrationServiceError
        • Class: FirebaseClientError
        • Class: FirebaseImplementationError
        • Class: FirestoreAdministrationRepository
        • Class: FirestoreAdministrationRepositoryError
        • Class: abstract FirestoreBaseRepository<T>
        • Class: FirestoreFilterAdapter
        • Class: FirestoreIdentityProviderRepository
        • Class: FirestoreIdentityProviderRepositoryError
        • Class: FirestoreOrgRepository
        • Class: FirestoreOrgRepositoryError
        • Class: FirestoreRepositoryError
        • Class: FirestoreUserClaimRepository
        • Class: FirestoreUserClaimRepositoryError
        • Class: FirestoreUserRepository
        • Class: FirestoreUserRepositoryError
        • Class: IdentityProviderServiceError
        • Classes
      • Enumerations
        • Enumeration: CollectionType
        • Enumeration: IdentityProviderType
        • Enumeration: Operator
        • Enumerations
      • Functions
        • Functions
        • Function: chunkOrgs()
        • Function: createAdministrationService()
        • Function: createFirestoreImplementation()
        • Function: createIdentityProviderService()
        • Function: isEmptyOrgs()
      • Interfaces
        • Interface: Administration
        • Interface: AdministrationBaseRepository
        • Interface: AdministrationService
        • Interface: AssentConsent
        • Interface: Assessment
        • Interface: BaseModel
        • Interface: BaseRepository<T>
        • Interface: Claims
        • Interface: CompositeCondition
        • Interface: CompositeFilter
        • Interface: CreateAdministrationServiceParams<AdminRepo, OrgRepo, UserClaimRepo>
        • Interface: CreateParams
        • Interface: DeleteParams
        • Interface: EducationalOrgsList
        • Interface: FieldCondition
        • Interface: FilterAdapter<T>
        • Interface: FirestoreCreateParams
        • Interface: FirestoreDeleteParams
        • Interface: FirestoreFetchDocumentParams
        • Interface: FirestoreGetAllParams
        • Interface: FirestoreGetByIdParams
        • Interface: FirestoreGetByNameParams
        • Interface: FirestoreGetByRoarUidParams
        • Interface: FirestoreGetParams
        • Interface: FirestoreGetWithFiltersParams
        • Interface: FirestoreImplementation
        • Interface: FirestoreRunTransactionParams<T>
        • Interface: FirestoreUpdateParams
        • Interface: FutureParams
        • Interface: GetAdministrationIdsForAdministratorParams
        • Interface: GetAdministrationIdsFromOrgsParams
        • Interface: GetAllParams
        • Interface: GetByNameParams
        • Interface: GetByProviderIdParams
        • Interface: GetByRoarUidParams
        • Interface: GetParams
        • Interface: GetRoarUidParams
        • Interface: IdentityProvider
        • Interface: IdentityProviderBaseRepository
        • Interface: IdentityProviderService
        • Interface: Legal
        • Interface: OrgBase
        • Interface: OrgBaseRepository
        • Interface: OrgsList
        • Interfaces
        • Interface: Result<T>
        • Interface: RunTransactionParams<T>
        • Interface: SingleFilter
        • Interface: UpdateParams
        • Interface: User
        • Interface: UserBaseRepository
        • Interface: UserClaim
        • Interface: UserClaimBaseRepository
        • Interface: createIdentityProviderServiceParams<IDPRepo, UserClaimRepo, UserRepo>
        • Interface: getAdministrationIdsFromOrgsParams
        • Interface: _setAdministrationIdsParams
      • Type Aliases
        • Type Alias: BaseFilter
        • Type Alias: ComparisonOperator
        • Type Alias: Condition
        • Type Alias: DocumentCreatedEvent
        • Type Alias: DocumentDeletedEvent
        • Type Alias: DocumentUpdatedEvent
        • Type Alias: DocumentWrittenEvent
        • Type Alias: ParameterValue
        • Type Aliases
        • Type Alias: SelectAllCondition
      • Variables
        • Variable: FirebaseAppClient
        • Variable: FirebaseAuthClient
        • Variable: FirestoreClient
        • Variable: ORG_NAMES
        • Variables API Documentation
    • Examples
      • Examples
    • Guides
      • Guides
  • Cloud Functions
    • gse-roar-admin
      • Admin Database
      • appendToAdminClaims()
      • associateassessmentuid()
      • createAdministratorAccount()
      • createGuestDocsForGoogleUsers()
      • createLevanteGroup()
      • createLevanteUsers()
      • createnewfamily()
      • createstudentaccount()
      • mirrorClasses()
      • mirrorCustomClaims
      • mirrorDistricts()
      • mirrorFamilies()
      • mirrorGroups()
      • mirrorSchools()
      • removefromadminclaims()
      • saveSurveyResponses()
      • setuidcustomclaims()
      • softDeleteUserAssignment()
      • softDeleteUserExternalData
      • softDeleteUser()
      • syncAssignmentCreated()
      • syncAssignmentDeleted()
      • syncAssignmentUpdated()
      • syncAssignmentsOnAdministrationUpdate()
      • syncAssignmentsOnUserUpdate()
      • syncCleverOrgs()
      • syncCleverUser()
    • gse-roar-assessment
      • Assessment Database
      • organizeBucketLogsByDate()
      • setuidclaims()
      • softDeleteGuestTrial()
      • softDeleteGuest()
      • softDeleteUserRun()
      • softDeleteUserTrial()
      • syncOnRunDocUpdate()
  • Internationalization
    • ROAM Fluency
    • ROAR Letter
    • ROAR Phoneme
    • Internationalization of ROAR Apps
    • ROAR Sentence
    • ROAR Word
  • Integrating New Apps
    • Integrating Roar Apps into the Dashboard
    • Dashboard Integration
    • Monitoring and Testing
    • Preparing the App for Packaging and Deployment
    • Packaging and Publishing to npm
    • Secrets in the GitHub Repository
  • Assets Optimization
    • Optimizing Assets
    • Audio Optimization Guide
    • Image Optimization Guide
  • ROAR Redivis Instance
    • ROAR Redivis Instance
    • ROAR Data Validator Trigger
    • ROAR Data Validator
  • Logging and Querying
    • ROAR Logging
  • Emulation
    • Running the Emulator
      • Commands
    • Emulator Configuration Guide
      • Configuration
      • Cypress Configuration
      • Setup and Dependencies
      • Firebase CLI Configuration
      • Firebase Emulator Configuration
      • GitHub Secrets and Workflows
      • Importing and Exporting Data
      • Local Environment Variables
  • Clowder Implementation
    • Clowder Integration
    • Letter - Clowder
    • Multichoice - Clowder
    • Phoneme - Clowder
    • ARF & CALF - Clowder

ROAR Sentence

Translation Guide for ROAR Sentence

1. Introduction

Welcome to the ROAR-Sentence Translation Guide — your comprehensive companion for making ROAR-Sentence accessible to a global audience. As we strive to break language barriers and reach learners worldwide, this guide outlines the steps to seamlessly integrate translations into the app.

What This Guide Covers:

  • Folder Structure: Learn how to organize word corpora and translation files within the app's directory.

  • Internationalization Setup: Dive into the setup of internationalization using i18next. Discover the process of adding new translations as the app evolves, fostering continuous improvement and expansion into diverse linguistic landscapes.

  • Asset Management: Collaborate with partners to ensure all required assets from assets.json are provided. Add the provided assets to Google Buckets. This section also details the importance of proper asset naming and organization.

  • Collaboration: Clearly state the expectations from partners regarding the provision of wordlist corpus files, translation files, and assets.

  • Testing and Deployment: Ensure the effectiveness of your translations by following testing procedures and deploying language updates seamlessly.

2. Folder Structure

2.1. Corpus

Create a new folder under src/experiment/corpus for each language, using the initials of the language. Inside each language folder, include at least two files: practice.csv and test.csv. Collaborate with partners to obtain the necessary content for these files.

Example:

src/
├─ experiment/
|   ├─ corpus/
|       ├─ en/          // English
|           ├─ practice.csv
|           ├─ test.csv
|       ├─ es/          // Spanish (Add more languages as needed)
|           ├─ practice.csv
|           ├─ test.csv
├─ ...
2.2. Translation Items

Create a new folder under src/locales for each language, using the initials of the language. Inside each language folder, include a file named translation.json. Ensure that all languages follow the same structure in their translation files. Collaborate with partners to obtain and maintain translation content.

Example:

src/
├─ locales/
|   ├─ en/          // English
|       ├─ translation.json
|   ├─ es/          // Spanish (Add more languages as needed)
|       ├─ translation.json
├─ ...

3. Internationalization Setup

3.1. File src/experiment/i18n.js

On i18n.js, import all the files from the corpus and translation items. For example import enTranslations from '../locales/en/translation.json'; Inside the file you will find the initialization of i18next and language detection. You must include all corpus items on sentenceList to manage different language corpora.

The following code represents the i18n.js file with comments on where to add files and define other languages:

// Import the necessary modules and functions
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';

// Import all your corpus files

// Define the sentenceList object for managing the corpus
export const sentenceList = {
  en: {
    corpusPractice: enCorpusPractice,
    corpusLab: enCorpusLab,
    corpusTOSREC: enCorpusTOSREC,
    corpusAI: enCorpusAI,
    corpusAIV1P1: enCorpusAIV1P1,
    corpusAIV1P2: enCorpusAIV1P2,
    corpusAIV2Testset: enCorpusAIV2Testset,
  },
  es: {
    corpusPractice: esCorpusPractice,
    corpusTest: esCorpusTest,
  },
  it: {
    corpusPractice: '',
    corpusLab: '',
    corpusTOSREC: '',
    corpusAI: '',
  },
  // add additional languages
};

// Set up i18next
i18next
  .use(LanguageDetector)
  .on('languageChanged', processCSV)
  .init({
    debug: false,
    load: 'languageOnly',
    fallbackLng: 'en',
    detection: {
      order: ['defaultToEnglish', 'querystring'],
    },
    resources: {
      en: {
        translation: enTranslations,
      },
      es: {
        translation: esTranslations,
      },
      it: {
        translation: itTranslations,
      },
      // add additional language
    },
  });


3.2. File src/experiment/trials/loadCorpus.js

The following code represents how to load the corpus for the specified language:

// define the csv corpus files that will be loaded
if (i18next.language === 'es') {
    csvAssets = {
        practice: sentenceList[i18next.language].corpusPractice,
        test: sentenceList[i18next.language].corpusTest,
  };
} // add additional language 
else {
  // Default to English
    csvAssets = {
        practice: sentenceList[i18next.language].corpusPractice,
        lab: sentenceList[i18next.language].corpusLab,
        ai: sentenceList[i18next.language].corpusAI,
        aiV1P1: sentenceList[i18next.language].corpusAIV1P1,
        aiV1P2: sentenceList[i18next.language].corpusAIV1P2,
        aiV2Testset: sentenceList[i18next.language].corpusAIV2Testset,
  };
}

After loading the corpus the csv files will be transformed to test and practice files. Follow the Spanish example below to transform the csv files:

const generateLanguageSpecificCorpus = (csvAssets) => {

  const language = i18next.language;

  if (language === 'es') {
    const testCorpus = transformCSVespTest(csvAssets.test);
    const trueSentences = shuffle(testCorpus.filter((row) => row.answer === true));
    const falseSentences = shuffle(testCorpus.filter((row) => row.answer === false));
    return {
      practice: transformCSVp(csvAssets.practice),
      test1: shuffle([... trueSentences.slice(0, 35), ... falseSentences.slice(0, 35)]),
      test2: shuffle([... trueSentences.slice(35, 70), ... falseSentences.slice(35, 70)]),
    }
  } // add more languages, default to english
    return {
      practice: transformCSVp(csvAssets.practice),
      lab: transformCSVlab(csvAssets.lab),
      ai: shuffle(transformCSVlab(csvAssets.ai)).slice(0, 130),
      aiV1P1: transformCSVlab(csvAssets.aiV1P1),
      aiV1P2: transformCSVlab(csvAssets.aiV1P2),
      aiV2: formParallelTestForm(transformCSVtestset(csvAssets.aiV2Testset), 50, 5),
    };

};

Make sure to integrate these code snippets into your app's structure, adapting them as needed for any additional languages or specific requirements.

4. Asset Management

4.1. assets.json
  • Collaborate with partners to ensure all required assets from assets.json are provided.
  • Add the provided assets to google buckets.
4.2. Google Buckets
  • Follow the English folder setup in the Google bucket to load the provided assets for each language. The bucket name is roar-sre

5. Collaboration

Clearly state the expectations from partners regarding the provision of corpus files, translation files, and assets.

6. Testing

For testing an specific language we will have to include /?lng=language. For example for English, we will use /?lng=en.

Roar-sentence has an specific consent form only for english, when adding a new language, we must specify: consent=false.

To access the different languages, we will have to include the parameters to the link, For example for English no story should be https://link-testing-or-localhost/?lng=en&consent=false.

Additionally, Roar-sentence is adapted to two different devices with have to be tested: Desktop and Tablet.

Edit this page
Last Updated:
Contributors: Elijah Kelly, Emily Arteaga
Prev
Internationalization of ROAR Apps
Next
ROAR Word