Zekr Quran Study Application Developer
Expert assistant for the Zekr open-source Quran study application built with Java, SWT, Apache Lucene, and Velocity templates.
What This Skill Does
This skill provides comprehensive guidance for developing and maintaining Zekr, a cross-platform Quran study application. It understands the architecture, build system, resource structure, and all subsystems including search, audio playback, internationalization, bookmarking, and theming.
Instructions
1. Understand the Project Structure
When working with Zekr code:
**Source Location**: Source code is distributed as `dist/zekr-src.jar` and extracted to `build/src/` during build**Main Entry Point**: `net.sf.zekr.ZekrMain` is the application entry point**Resources**: All resources are in `res/` directory organized by type (config, text, audio, ui, lang, bookmark, image)**Dependencies**: All JARs are in `lib/` directory and loaded at runtime2. Build System (Apache Ant)
Use these Ant commands for building:
```bash
Full build (extract source, compile, create JAR)
ant dist
Compile only
ant compile
Generate documentation
ant javadoc
Run the application
ant run
Clean build artifacts
ant clean
```
**Build Process Flow**:
1. Extract source from `dist/zekr-src.jar` to `build/src/`
2. Compile Java source to `build/classes/`
3. Copy `.properties` files as resources
4. Create final JAR at `dist/zekr.jar`
3. Running the Application
**Linux/Unix**:
```bash
./zekr.sh
```
**Direct Java Execution**:
```bash
java -Xms20m -Xmx128m -cp "lib/*:dist/zekr.jar" net.sf.zekr.ZekrMain
```
**JVM Requirements**:
Minimum heap: 20MBMaximum heap: 128MBJava 1.5 targetNative library path configured for SWT bindings4. Key Architecture Components
**GUI Framework (SWT)**:
Native cross-platform UI toolkitPlatform-specific SWT JARs in `lib/`UI components in `net.sf.zekr.ui` package**Template Engine (Velocity 1.6.2)**:
HTML generation for Quran display in `net.sf.zekr.engine.template`Custom resource loader: `ZekrFileResourceLoader`Templates in `res/ui/theme/*/` directoriesConfiguration in `res/config/lib/velocity.properties`**Search Engine (Lucene 3.0.0)**:
Full-text indexing in `net.sf.zekr.engine.search`Multi-language stemming with SnowballIndices stored in `res/text/index/`Configuration in `res/config/search-info.properties`Supports advanced queries: proximity, wildcard, fuzzy, boolean**Audio Playback**:
Multi-format support (MP3, Ogg, Speex) in `net.sf.zekr.engine.audio`Online/offline recitation with 200MB cacheMultiple reciters configured in `res/audio/*.properties`URL template format: `http://server/path/%1$03d%2$03d.mp3`Playback modes: single aya, multi-aya, page, sura, juz, continuous**Internationalization**:
17+ language packs in `res/lang/` (XML format, UTF-8)RTL support for Arabic, Persian, Urdu, HebrewDynamic locale switching in `net.sf.zekr.engine.i18n`Translatable metadata in `res/text/metadata/`5. Configuration Files
**`res/config/config.properties`** - Main runtime settings:
Quran layout and translation displayAudio player behavior and cachingSearch configuration (max results, highlighting)Theme and language defaultsSupports Velocity variable substitution**`res/config/resource-path.properties`** - Dynamic path resolution:
Uses `{1}` placeholder for user workspaceDefines paths for all resource types**`res/config/search-info.properties`** - Search engine settings:
Per-language character normalizationStop words for multiple languagesDiacritic handling patternsUnicode letter ranges**`res/config/shortcut.xml`** - Keyboard shortcuts with RTL support
**`res/config/lib/logger.properties`** - Log4j configuration:
Rolling file appender400KB file size limit6. Package Structure Reference
`net.sf.zekr.ZekrMain` - Application entry point`net.sf.zekr.engine.search` - Lucene search with multi-language support`net.sf.zekr.engine.audio` - Audio playback with caching`net.sf.zekr.engine.template` - Velocity rendering`net.sf.zekr.engine.i18n` - Internationalization`net.sf.zekr.engine.data` - Quranic data structures`net.sf.zekr.engine.bookmark` - XML bookmark management`net.sf.zekr.engine.config` - Configuration management`net.sf.zekr.engine.log` - Custom Log4j implementation`net.sf.zekr.ui` - SWT UI components7. Extensibility Points
**Add New Reciter**:
Create `.properties` file in `res/audio/`Define URL template and bitrate**Create New Theme**:
Create directory in `res/ui/theme/`Add Velocity templates (page.vm, search-result.vm, aya-result.vm)Add CSS stylesheets in `css/` subdirectoryCreate `theme.properties` with font/color/layout config**Add Language Pack**:
Create XML file in `res/lang/` with UTF-8 encodingInclude UI strings and locale direction (LTR/RTL)**Add Translation**:
Package as `.trans.zip` file in `res/text/trans/`**Customize Search**:
Modify `search-info.properties` for language-specific rulesConfigure custom Lucene query builders8. Development Best Practices
Always test with both LTR and RTL languagesVerify audio playback with online and offline modesTest search with multiple languages and advanced queriesEnsure template changes work across all themesValidate configuration changes don't break backward compatibilityTest with minimum JVM heap (20MB) for resource constraintsVerify cross-platform compatibility (Linux, Windows, macOS)9. Debugging and Logging
Log files configured in `res/config/lib/logger.properties`Rolling file appender with 400KB limitCustom Log4j implementation in `net.sf.zekr.engine.log`Check logs for search indexing, audio caching, and template errors10. Resource Management
**Text Resources**:
Quran text from Tanzil project in `res/text/quran/`Translations in `res/text/trans/`Metadata in 15+ languages in `res/text/metadata/`**UI Resources**:
Themes in `res/ui/theme/`JavaScript libraries in `res/ui/js/`Icons and graphics in `res/image/` (multiple sizes)**Embedded HTTP Server**:
NanoHTTPD on port 8920Serves local Quran display contentExamples
**Building after code changes**:
```bash
ant clean
ant dist
ant run
```
**Adding a new reciter** (create `res/audio/new-reciter.properties`):
```properties
name=New Reciter Name
bitrate=64
url=http://example.com/quran/%1$03d%2$03d.mp3
```
**Testing with custom heap size**:
```bash
java -Xms30m -Xmx256m -cp "lib/*:dist/zekr.jar" net.sf.zekr.ZekrMain
```
Important Notes
Source code must be extracted from `dist/zekr-src.jar` before compilationSWT JARs are platform-specific; ensure correct version for target OSAudio cache is limited to 200MB; monitor for large recitation setsSearch indices must be rebuilt after adding new translationsTemplate changes require theme switching to take effectConfiguration supports Velocity variables for dynamic path resolutionRTL languages require special handling in UI layouts and keyboard shortcuts