HrRoadways is a comprehensive project designed to provide users with an intuitive platform to check bus routes, timings, and real-time updates for government bus services.
- React with Vite Framework
HrRoadways/ ├── Databases/ │ └── State_Database/ ├── src/ │ ├── components/ │ └── assets/
- Json Database hosting link - https://jsonblob.com/api/jsonBlob/1333092652136194048
- Clone the repository:
git clone https://github.com/NishantRana07/HrRoadways.git
- Navigate to the project directory and install dependencies:
npm install
- Run the development server to access the site locally:
npm run dev
A centralized repository to store and manage information about popular places across various locations.
To add popular places to the repository, follow the format specified below:
Places/ ├── Location/ │ └── Location.json
{
"location": "City or Region Name",
"places": [
{
"name": "Place Name",
"category": "Category (e.g., Historical, Restaurant, Park, etc.)",
"description": "A brief description of the place.",
"latitude": "Latitude Coordinate",
"longitude": "Longitude Coordinate"
}
]
}
Here is an example of how to add a location:
File: Places/NewYork/NewYork.json
{
"location": "New York",
"places": [
{
"name": "Central Park",
"category": "Park",
"description": "A large public park in New York City, featuring lakes, gardens, and walking trails.",
"latitude": "40.785091",
"longitude": "-73.968285"
},
{
"name": "Statue of Liberty",
"category": "Historical",
"description": "An iconic symbol of freedom and democracy located on Liberty Island.",
"latitude": "40.689247",
"longitude": "-74.044502"
}
]
}
Guidelines for contributing to the repository, including adding content and ensuring Hindi translations.
If you are adding content to the site or creating new pages, please:
- Apply logic for Hindi translation and add translations for all words.
- Use PNG or JPG files for minimal size and always compress images.
- Ensure that your forked repository is up to date before submitting a pull request.
Click on the "Fork" button at the top right of the repository page.
git clone https://github.com/your-username/HrRoadways.git
git checkout -b your-branch-name
Ensure that you:
- Apply the logic for Hindi translation.
- Compress images before uploading.
git add .
git commit -m "Describe your changes"
git push origin your-branch-name
Go to the original repository and click on "New Pull Request."
Before making a pull request, ensure that your forked repository is up to date.
git remote add upstream https://github.com/NishantRana07/HrRoadways.git
git fetch upstream
git checkout main
git merge upstream/main
git push origin main
By following these steps, you ensure that your pull request is based on the latest code.
Comprehensive guidelines for contributing to the repository and implementing bilingual functionality.
If you are adding content to the site or creating new pages, please:
- Apply logic for Hindi translation and add translations for all words.
- Use PNG or JPG files for minimal size and always compress images.
- Ensure that your forked repository is up to date before submitting a pull request.
Click on the "Fork" button at the top right of the repository page.
git clone https://github.com/your-username/HrRoadways.git
git checkout -b your-branch-name
Ensure that you:
- Apply the logic for Hindi translation.
- Compress images before uploading.
git add .
git commit -m "Describe your changes"
git push origin your-branch-name
Go to the original repository and click on "New Pull Request."
Before making a pull request, ensure that your forked repository is up to date.
git remote add upstream https://github.com/NishantRana07/HrRoadways.git
git fetch upstream
git checkout main
git merge upstream/main
git push origin main
By following these steps, you ensure that your pull request is based on the latest code.
The HrRoadways project supports bilingual functionality, allowing users to switch between English and Hindi. This is achieved through a translation logic that provides translated text for various components.
The translation data is organized in a structured format within the components. Each language has its own set of translations for different text elements.
A state variable (isHindi
) is used to toggle between English and Hindi translations.
A function (handleToggleLanguage
) is provided to switch between languages.
Add the translations for both English and Hindi in the respective component.
Use the translation logic to display the translated text based on the current language state.
const translations = {
en: {
heading: "Your English Heading",
description: "Your English Description",
},
hi: {
heading: "आपका हिंदी शीर्षक",
description: "आपका हिंदी विवरण",
},
};
const currentLanguage = isHindi ? translations.hi : translations.en;
return (
<div>
<h1>{currentLanguage.heading}</h1>
<p>{currentLanguage.description}</p>
</div>
);
The App.jsx
file manages the routing and includes the language toggle functionality.
const [isHindi, setIsHindi] = useState(false);
const handleToggleLanguage = () => setIsHindi(!isHindi);
return (
<Router>
<Navigation isHindi={isHindi} onToggleLanguage={handleToggleLanguage} />
<Routes>
<Route path="/" element={<Hero isHindi={isHindi} />} />
{/* Other routes */}
</Routes>
<Footer isHindi={isHindi} />
</Router>
);
The isHindi
state is passed to components that require translations, such as Hero
and Footer
.
The Hero
component uses the translation logic to display content in the selected language.
const translations = {
en: {
heading: "Haryana Roadways - Your Own Bus Service",
subheading: "Your Journey, Our Pride | आपकी यात्रा, हमारा गौरव",
departure: "From",
arrival: "To",
button: "Search Buses",
popular: "Popular Routes",
allBuses: "All Buses",
volvo: "Volvo AC",
superExpress: "Super Express",
ordinary: "Ordinary",
searchPlaceholder: "Search bus stands...",
},
hi: {
heading: "हरियाणा रोडवेज - आपकी अपनी बस सेवा",
subheading: "आपकी यात्रा, हमारा गौरव",
departure: "कहाँ से",
arrival: "कहाँ तक",
button: "बसें खोजें",
popular: "लोकप्रिय मार्ग",
allBuses: "सभी बसें",
volvo: "वोल्वो एसी",
superExpress: "सुपर एक्सप्रेस",
ordinary: "साधारण",
searchPlaceholder: "बस स्टैंड खोजें...",
},
};
const currentLanguage = isHindi ? translations.hi : translations.en;
return (
<div>
<h1>{currentLanguage.heading}</h1>
<p>{currentLanguage.subheading}</p>
{/* Other translated elements */}
</div>
);
Ensure that all new content and pages implement the translation logic.
Use PNG or JPG files for images and always compress them to minimize size.
Before submitting a pull request, always ensure that your forked repository is up to date.
By following this documentation, developers can effectively add and manage translations in the HrRoadways project. This ensures a consistent bilingual experience for users.
If you have any questions or need further assistance, feel free to reach out to the project maintainers.