Module:Bangladesh Gazette/doc
This module provides metadata handling and categorization for Bangladesh Gazette files on Wikimedia Commons. It powers the {{Bangladesh Gazette Information}} template.
Purpose
The module generates formatted information boxes for Bangladesh Gazette documents and automatically categorizes them based on gazette type, publication date, part number (for weekly gazettes), and issuing organization (for extraordinary gazettes). It supports both weekly and extraordinary gazette types with bilingual (English/Bengali) display.
Usage
This module is not intended to be invoked directly. Instead, use the {{Bangladesh Gazette Information}} template. See Template:Bangladesh Gazette Information/doc for complete usage instructions.
From template pages:
{{Bangladesh Gazette Information
|type = weekly
|date = 2025-12-04
|part = I
|source = http://www.dpp.gov.bd/...
}}
From Lua modules (if needed):
local p = require('Module:Bangladesh Gazette')
local result = p.infobox(frame)
Functions
Main functions
p.infobox(frame)- Main function that generates the complete information box with metadata and categories. This is invoked by {{Bangladesh Gazette Information}}.
- Parameters: Receives a frame object with parent arguments from the template
- Returns: Formatted wikitext containing the information box and category tags
p.hasInfobox(frame)- Utility function to check if the Bangladesh Gazette Information template is used on the current page.
- Returns: "yes" if template is found, "no" otherwise
Internal helper functions
The module contains several internal functions that handle specific aspects of data processing:
- Part normalization
normalizePart(part)– Accepts Roman numerals (I-VIII), Arabic numerals (1-8), or mixed case, and normalizes to uppercase Roman numerals
- Date parsing
parseDate(dateStr)– Extracts year, month, and ISO week number from date stringsgetWeekOfMonth(dateStr)– Calculates which week of the month (1-5) a date falls ingetMonthName(monthNum)– Converts month number to English month name
- Number conversion
toBengaliNumber(num)– Converts English numerals to Bengali numerals (০-৯)toEnglishNumber(num)– Converts Bengali numerals to English numerals (0-9)getOrdinalEn(num)– Generates English ordinals (1st, 2nd, 3rd, etc.)getOrdinalBn(num)– Generates Bengali ordinals (১ম, ২য়, ৩য়, ৪র্থ, etc.)
- Categorization
getWeeklyCategories(args, pageName)– Generates categories for weekly gazettesgetExtraordinaryCategories(args, pageName)– Generates categories for extraordinary gazettes
- Source detection
isDPPUrl(url)– Detects if a URL is from the Department of Printing and Publications (dpp.gov.bd)
Data structures
Part name mappings
The module maintains mappings for the eight parts of Bangladesh Weekly Gazette:
| Part | English (Short) | Bengali (Short) | Category |
|---|---|---|---|
| I | Statutory notifications | বিধিবদ্ধ প্রজ্ঞাপন | Statutory notifications |
| II | Government appointments | সরকারি নিয়োগ | Government appointments |
| III | Defence notifications | প্রতিরক্ষা প্রজ্ঞাপন | Defence notifications |
| IV | Patent office notifications | পেটেন্ট অফিসের প্রজ্ঞাপন | Patent office notifications |
| V | Acts and Bills | আইন ও বিল | Acts and Bills |
| VI | Supreme Court and Public Service notifications | সুপ্রিম কোর্ট ও সরকারি কর্মকমিশনের প্রজ্ঞাপন | Supreme Court and Public Service notifications |
| VII | Miscellaneous notifications | বিবিধ অবিধিবদ্ধ প্রজ্ঞাপন | Miscellaneous notifications |
| VIII | Private advertisements | ব্যক্তিগত বিজ্ঞাপন | Private advertisements |
Long-form descriptions are also maintained for each part in both English and Bengali for use in the information box.
Conversion tables
- romanToArabic – Maps Roman numerals (I-VIII, i-viii) to Arabic (1-8)
- arabicToRoman – Maps Arabic numerals (1-8) to Roman (I-VIII)
- monthNames – Maps month numbers (01-12) to English month names
Categorization scheme
Weekly gazettes
Files with type=weekly are categorized as:
Category:Bangladesh Weekly Gazette from {Year} {Part Name}
Example: Category:Bangladesh Weekly Gazette from 2025 Private advertisements
Extraordinary gazettes
Files with type=extraordinary are categorized as:
Category:Bangladesh Extraordinary Gazette from {Month} {Year} by {Ministry}
Example: Category:Bangladesh Extraordinary Gazette from June 2024 by Ministry of Law, Justice and Parliamentary Affairs
Error categorization
Files missing required parameters are categorized in:
Category:Bangladesh Gazette files needing parameters
Field order and auto-generation
The information box displays fields in this specific order:
- Gazette Type (always first) – Auto-generated bilingual label
- Description – Auto-generated from part number for weekly gazettes (overridable)
- Part (weekly only) – Normalized and displayed bilingually with full description
- Date – Publication date (required)
- Volume (weekly only) – ISO week number of year, auto-calculated from date (overridable)
- Week (weekly only) – Week of month (1-5), auto-calculated (overridable)
- Source – Automatically wrapped with {{Source-DPP}} if from dpp.gov.bd
- Organization (extraordinary only) – Ministry or issuing organization
- Author – Defaults to Institution:Government of Bangladesh (overridable)
- Page Range – Displayed bilingually in both English and Bengali numerals
- Permission (near end)
- Other Versions (always last)
Bilingual support
The module uses {{LangSwitch}}, {{En}}, and {{Bn}} templates to provide bilingual display:
- Field labels appear in both English and Bengali based on user preference
- Ordinal numbers use appropriate format for each language
- Part names and descriptions are shown in both languages
- Page ranges display in both English (0-9) and Bengali (০-৯) numerals
Examples
Weekly gazette with minimal parameters
{{#invoke:Bangladesh Gazette|infobox
|type = weekly
|date = 2025-12-04
|part = VIII
|source = http://www.dpp.gov.bd/upload_file/gazettes/59439_93575.pdf
}}
This will:
- Auto-generate description based on Part VIII
- Calculate volume as ISO week 49
- Calculate week of month as 1st week
- Default author to Government of Bangladesh
- Categorize in "Bangladesh Weekly Gazette from 2025 Private advertisements"
Extraordinary gazette
{{#invoke:Bangladesh Gazette|infobox
|type = extraordinary
|description = Notification regarding appointment of High Court judges
|date = 2024-06-10
|ministry = Ministry of Law, Justice and Parliamentary Affairs
|source = https://dpp.gov.bd/site/page/9012
}}
This will categorize in "Bangladesh Extraordinary Gazette from June 2024 by Ministry of Law, Justice and Parliamentary Affairs"
Dependencies
This module depends on the following templates:
- {{Information}} – Base template for file information boxes
- {{LangSwitch}} – For bilingual field labels
- {{En}} and {{Bn}} – For language-specific content
- {{Source-DPP}} – For formatting DPP source URLs
- Institution:Government of Bangladesh – Default author
- Institution:Department of Printing and Publications – Used with DPP sources
- {{Information field}} – For custom fields in the information box
Technical notes
- The module uses Lua's
os.timeandos.datefunctions for date calculations - ISO week numbers follow the ISO 8601 standard (week starts Monday, first week has Thursday of the year)
- Part number validation is case-insensitive and accepts multiple formats (I, i, 1 all map to Part I)
- Page exclusions prevent categorization of the template itself, documentation pages, and test pages
- The module handles missing parameters gracefully by using default values or auto-calculation where possible
See also
- Template:Bangladesh Gazette Information – The template that uses this module
- Template:Bangladesh Gazette Information/doc – Complete template documentation
- Category:Bangladesh Gazette – Parent category for all Bangladesh Gazette files
- Category:Bangladesh Weekly Gazette – Category for weekly gazettes
- Category:Bangladesh Extraordinary Gazette – Category for extraordinary gazettes
- Institution:Government of Bangladesh
- Institution:Department of Printing and Publications