This repository contains the source code for the official website of the Unofficial Crusader Patch (UCP). The site is designed to be a modern, dynamic, and community-driven resource, built to mirror the look and feel of the UCP3 GUI.
Because this website fetches data dynamically from local files (/lang/*.json
) and the GitHub API, you cannot test it by simply opening index.html
in your browser. You must run it from a local web server to avoid security errors (CORS policy).
Here are a few easy ways to do this:
If you have Python installed on your system, this is the simplest method.
- Open a terminal or command prompt.
- Navigate to the root directory of this project (the folder containing
index.html
). - Run the following command:
python -m http.server
- Open your web browser and navigate to
http://localhost:8000
.
If you use Visual Studio Code as your editor:
- Install the Live Server extension from the VS Code Marketplace.
- Open the project folder in VS Code.
- Right-click on the
index.html
file in the file explorer and select "Open with Live Server". - A new browser tab will automatically open with the website running.
The website is fully localizable. Adding a new language is straightforward.
Open the languages.json
file in the root directory. Add your new language to the list, using the two-letter language code as the key and the native language name as the value.
Example: Adding French
{
"en": "English",
"de": "Deutsch",
"fr": "Français" // Add this line
}
- Go to the
/lang/
directory. - Make a copy of
en.json
. - Rename the copy to match your language code (e.g.,
fr.json
). - Open the new file and translate all the string values on the right side.
The website also uses language-specific files for larger content sections like the FAQ and AI Format pages.
- In the
/lang/
directory, make copies offaq-en.json
andaic-en.json
. - Rename them to match your language code (e.g.,
faq-fr.json
andaic-fr.json
). - Translate the content within these new files.
Fallback System: If a translation file for a specific language is not found (e.g., faq-fr.json
doesn't exist), the website will automatically fall back to the English (en
) version for that content. This ensures the site always remains functional even if translations are incomplete.
The project is organized to separate structure (HTML), styling (CSS), logic (JS), and content (JSON/Assets).
/index.html
: The main skeleton of the site./assets/
: Contains all static assets like images, icons, and fonts used for styling./css/
: Contains the main stylesheet (style.css
)./js/
: Contains the JavaScript logic.api.js
: Handles all calls to the GitHub API.ui.js
: Contains functions for rendering HTML content.main.js
: The main application controller that ties everything together.
/lang/
: Contains all localization and data files./languages.json
: The central manifest of all supported languages.
-
Populate the
/assets/
Folder: The most critical step is to copy all the necessary image files from the UCP3 GUI into the/assets/ucp3/
folder. Thecss/style.css
file is already set up to use them, which will correctly render the borders, tabs, and backgrounds. -
Complete Data Files: Finish translating and populating the content for all languages in the
/lang/
directory, especially for theaic-xx.json
andfaq-xx.json
files. -
Add New Tabs: To add a new content tab (e.g., "Features" or "Contributing"), you will need to:
- Add a new button to the
<nav>
inindex.html
. - Add a new
case
to theswitchTab
function injs/main.js
. - Create a new render function in
js/ui.js
to generate the HTML for the new tab's content.
- Add a new button to the