This project is licensed under the terms of the GNU General Public License v3.0. See the LICENSE file for details.
Shoutout to @Jonny-exe for his JSON file of 5000 random german words: https://github.com/Jonny-exe/German-Words-Library
Maybe https://github.com/eymenefealtun/all-words-in-all-languages?tab=readme-ov-file could be used for building a bigger project, but looks like overkill to me right now.
This project uses the Deepl free API and also uses Twilio (premium account for the whatsapp messaging service)
You will need both of these and their respective API keys for your .env
file if you want to make the rake task exectuable. Both have great documentation.
run bundle exec rake daily_reminder:send
in your terminal to test the rake task, you should then get this to know it's working:
(called from <main> at /Users/axel/projects/daily_german_bot/daily_german_bot/config/environment.rb:5)
Sent daily reminder: Guten Tag!!!
Hier ist deine tägliche Vokabeln-Errinerung:
🇩🇪 Froschart
🇬🇧 Frog species
- Objective: Ensure the Rake task runs daily at 10am.
- Explanation: The
config/schedule.rb
file is used by thewhenever
gem to manage cron jobs. This setup schedules thedaily_reminder:send
task to run every day at 10am. - Steps:
- Ensure you have the
whenever
gem installed:gem 'whenever', require: false
- Example
config/schedule.rb
:every 1.day, at: '10:00 am' do rake "daily_reminder:send" end
- Deployment: For this to work, you need to deploy your application to a server and have a mechanism to ensure cron jobs run. This typically involves having Sidekiq running on a production server. The
whenever
gem updates the crontab on the server to run your scheduled tasks.
- Ensure you have the
- Objective: Deploy the application to a production server.
- Explanation: Deploying to a cloud server ensures your application is always running and can handle scheduled tasks and user requests.
- Steps:
- Choose a Deployment Method: Capistrano is a common choice for Rails apps.
gem 'capistrano', '~> 3.11' gem 'capistrano-rails', '~> 1.4' gem 'capistrano-passenger', '~> 0.2.0' gem 'capistrano-rbenv', '~> 2.1' gem 'capistrano-sidekiq', '~> 2.0'
- Configure Capistrano: Setup
config/deploy.rb
and related files for your environment. - Provision the Server: Ensure the server has all necessary dependencies, including Ruby, Rails, MySQL, Redis, and Sidekiq.
- Deploy the Application:
cap production deploy
- Choose a Deployment Method: Capistrano is a common choice for Rails apps.
- Objective: Allow users to sign up and select languages they want to learn.
- Explanation: Create a web interface for user interaction and store their preferences.
- Steps:
- Set Up Routes and Controllers: Define routes and actions for handling user input.
- Create Views: Build forms for user registration and language selection.
- Store User Data Securely: Use ActiveRecord to create a
User
model and store phone numbers and language preferences securely. - Example Migration:
create_table :users do |t| t.string :phone_number, null: false, unique: true t.string :language, null: false t.timestamps end
- Objective: Utilize the
deepl-rb
gem for translations. See https://github.com/wikiti/deepl-rb - Explanation: This gem provides a convenient interface to the DeepL API.
- Steps:
- Add to Gemfile:
gem 'deepl-rb'
- Configure the Gem: Set up API keys and usage within your service objects.
- Example Usage:
require 'deepl' client = DeepL::Client.new(auth_key: ENV['DEEPL_AUTH_KEY']) translation = client.translate(text: "Hallo Welt", target_lang: "EN")
- Add to Gemfile:
- Objective: Expand functionality to support multiple languages.
- Explanation: Use DeepL's glossary feature to manage translations more effectively.
- Steps:
- Set Up Glossaries: Define glossaries for different language pairs.
- Use Glossaries in Translations: Integrate glossary use within your translation logic.
- Example Glossary Setup:
glossary = client.create_glossary(name: "MyGlossary", source_lang: "DE", target_lang: "EN", entries: {"Hallo" => "Hello"}) translation = client.translate(text: "Hallo", target_lang: "EN", glossary_id: glossary.id)
- Objective: Identify potential features to enhance the application.
- Suggestions:
- User Authentication: Implement user accounts with authentication to manage preferences.
- Progress Tracking: Allow users to track their learning progress over time.
- Notifications: Send reminders or additional learning materials via email or SMS.
- Gamification: Add features like quizzes and rewards to make learning more engaging.
- Content Customization: Personalize the learning experience based on user preferences and progress.