ohcnetwork / life

Verified Crowd-Sourced Emergency Services Directory
https://life.coronasafe.network/
84 stars 56 forks source link

i18n - Indian Translations #85

Closed Deep-Codes closed 3 years ago

Deep-Codes commented 3 years ago

Adding Multiple Language Feature

Deep-Codes commented 3 years ago

Docs for Adding a Translations:

All Translations are inside the /locales folder

Each language has a Folder with the Name of its Respective Code Based on this.

For example: English Translation would be in /locales/en and Marathi in /locales/mr

Each File Inside the Language Folder would have Multiple Files based on the Template we would give. (Soon)

For Example Home Page has English Translation in /locales/en/home.js

export default {
    title: 'Life',
    description: 'Verified Crowd Sourced Emergency Services Directory',
    oxygen: 'Oxygen',
    medicine: 'Medicine',
    hospital: 'Hospital',
    ambulance: 'Ambulance',
    helpline: 'Helpline',
    plasma: 'Plasma',
    searchPlaceholder: 'Search for availability in a State or District',
    state: 'State',
    district: 'District',
    covid19Stats: 'Covid19 Statistics',
    oxygenRequirements: 'Oxygen Requirements',
    contributeData: 'Contribute Verified Data',
    campaigns: 'Campaigns',
    partnerWithUs: 'Partner With Us',
    curatedBy: 'Curated By',
    supportedBy: 'Supported By',
    poweredBy: 'Powered By',
    github: 'Github',
    database: 'Database',
    about: 'About'
};

Here the key is the value of word we want to be translated and the value is the translated word of the key in the respective language.

To add marathi translations to the Home Page

I gotta create a file in /locales/mr/home.js and add the following :

export default {
    title: 'लाइफ़',
    description: 'सत्यापित क्रोड सोर्सिड इमर्जन्सी सर्व्हिसेस निर्देशिका',
    oxygen: 'ऑक्सिजन',
    medicine: 'औषध',
    hospital: 'रुग्णालय',
    ambulance: 'रुग्णवाहिका',
    helpline: 'हेल्पलाइन',
    plasma: 'प्लाझ्मा',
    searchPlaceholder: 'राज्य किंवा जिल्ह्यात उपलब्धतेचा शोध घ्या',
    state: 'राज्य',
    district: 'जिल्हा',
    covid19Stats: 'कोविड 19 आकडेवारी',
    oxygenRequirements: 'ऑक्सिजन आवश्यकता',
    contributeData: 'सत्यापित डेटाचे योगदान द्या',
    campaigns: 'मोहिमा',
    partnerWithUs: 'आमच्यासह भागीदार',
    curatedBy: 'क्युरेटेड बाय',
    supportedBy: 'समर्थित',
    poweredBy: 'द्वारा समर्थित',
    github: 'गीथब',
    database: 'डेटाबेस',
    about: 'बद्दल'
};
Deep-Codes commented 3 years ago

Indian Language Codes : Refer