LinguaLink Installation Guide
=============================

This guide walks through installing and running LinguaLink on Windows.


1) Prerequisites
----------------

Install these first:
- Java Development Kit (JDK) 17
- Internet connection (required for dependency download, optional for online translation fallback)

Optional but useful:
- Git
- IntelliJ IDEA or VS Code


2) Verify Your Environment
--------------------------

Open PowerShell and run:

- `java -version`
  Expected: Java 17.x

- `javac -version`
  Expected: 17.x

If these commands fail or show a different major version, update your Java installation and PATH.


3) Get the Project
------------------

If you already have the project folder, skip this step.

If cloning:
- `git clone <your-repo-url>`
- `cd LinguaLink`


4) Build the Project
--------------------

From the project root, run:

- `.\mvnw.cmd clean package`

What this does:
- downloads dependencies
- compiles all modules
- runs tests
- builds artifacts


5) Run the Applications
-----------------------

Run the web app:
- `.\mvnw.cmd -pl lingualink-web spring-boot:run`
- Open `http://localhost:8080`

Run the console app:
- `.\mvnw.cmd -pl lingualink-app exec:java`


6) Environment Configuration
----------------------------

Main runtime settings are in:
- `lingualink-web/src/main/resources/application.properties`

Key settings:

- `SERVER_PORT`
  - Purpose: sets the web server port.
  - Default behavior: if unset, app uses port 8080.
  - PowerShell example:
    - `$env:SERVER_PORT=9090`
    - `.\mvnw.cmd -pl lingualink-web spring-boot:run`

- `lingualink.translation.mymemory.enabled`
  - Purpose: enable/disable online fallback translation in web module.
  - Default in project: `true`
  - Change it in `application.properties` to `false` for local-only translation.


7) Common Setup Issues
----------------------

- "java is not recognized"
  - JDK is not installed or PATH is not configured.

- Build fails on dependency download
  - Check internet connection or corporate proxy settings.

- Port 8080 already in use
  - Set a different port with `SERVER_PORT` (example above).

- Web app starts but page does not load
  - Confirm terminal shows startup complete and use the same port shown in logs.


8) Updating After Changes
-------------------------

After pulling new code:
- `.\mvnw.cmd clean package`

If only running tests:
- `.\mvnw.cmd test`
