Spaces:
Sleeping
Sleeping
Commit ·
4217c16
1
Parent(s): f099144
Fix Malaysian language translations for step titles and analysis results headers - Translate all step titles (Step 1-6) to Malaysian - Fix STEP/LANGKAH prefix translation - Translate Additional Analysis Results header - Translate sub-headers (Analysis, Summary, Formatted Analysis, Detailed Interpretations) - Fix Economic Impact Analysis messages - Ensure all tables display properly in both languages
Browse files- modules/results.py +129 -59
- utils/translations.py +19 -166
modules/results.py
CHANGED
|
@@ -23,7 +23,7 @@ from utils.ocr_utils import extract_data_from_image
|
|
| 23 |
from modules.admin import get_active_prompt
|
| 24 |
from utils.feedback_system import (
|
| 25 |
display_feedback_section as display_feedback_section_util)
|
| 26 |
-
from utils.translations import t, get_language
|
| 27 |
|
| 28 |
# Import CropDrive integration for user ID
|
| 29 |
try:
|
|
@@ -168,22 +168,38 @@ def display_step1_placeholder_tables(analysis_data, detailed_text):
|
|
| 168 |
try:
|
| 169 |
display_overall_results_summary_table(analysis_data)
|
| 170 |
except Exception as _e:
|
| 171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
elif num == 1:
|
| 173 |
try:
|
| 174 |
display_soil_ratio_table(analysis_data)
|
| 175 |
except Exception:
|
| 176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
elif num == 2:
|
| 178 |
try:
|
| 179 |
display_leaf_ratio_table(analysis_data)
|
| 180 |
except Exception:
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
elif num == 3:
|
| 183 |
try:
|
| 184 |
display_nutrient_gap_analysis_table(analysis_data)
|
| 185 |
except Exception:
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
except Exception as e:
|
| 188 |
logger.error(f"Error rendering numbered table placeholder {num}: {e}")
|
| 189 |
|
|
@@ -2794,7 +2810,11 @@ def display_raw_data_section(results_data):
|
|
| 2794 |
else:
|
| 2795 |
display_leaf_data_table(leaf_data)
|
| 2796 |
else:
|
| 2797 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2798 |
st.write(f"{t('results_data_keys', 'Results data keys')}: {list(results_data.keys())}")
|
| 2799 |
if analysis_results:
|
| 2800 |
st.write(f"{t('analysis_results_keys', 'Analysis results keys')}: {list(analysis_results.keys())}")
|
|
@@ -6285,9 +6305,7 @@ def display_step_by_step_results(results_data):
|
|
| 6285 |
continue
|
| 6286 |
|
| 6287 |
step_number = step_result.get('step_number', i+1)
|
| 6288 |
-
|
| 6289 |
-
# Translate step title if it contains English patterns
|
| 6290 |
-
step_title = translate_step_title(raw_step_title, step_number)
|
| 6291 |
|
| 6292 |
# Create a visual separator between steps
|
| 6293 |
if i > 0:
|
|
@@ -6584,6 +6602,9 @@ def display_step_block(step_result, step_number, step_title):
|
|
| 6584 |
|
| 6585 |
config = step_configs.get(step_number, {"color": "#667eea", "icon": "📋", "description": t('results_step_analysis', 'Analysis Step')})
|
| 6586 |
|
|
|
|
|
|
|
|
|
|
| 6587 |
# Create a prominent step header with step-specific styling
|
| 6588 |
st.markdown(f"""
|
| 6589 |
<div style="
|
|
@@ -6604,7 +6625,7 @@ def display_step_block(step_result, step_number, step_title):
|
|
| 6604 |
font-size: 18px;
|
| 6605 |
margin-right: 20px;
|
| 6606 |
">
|
| 6607 |
-
{config['icon']}
|
| 6608 |
</div>
|
| 6609 |
<div>
|
| 6610 |
<h3 style="color: white; margin: 0; font-size: 24px;">{step_title}</h3>
|
|
@@ -7092,7 +7113,11 @@ def display_enhanced_step_result(step_result, step_number):
|
|
| 7092 |
if detailed_text.strip():
|
| 7093 |
parse_and_display_json_analysis(detailed_text)
|
| 7094 |
else:
|
| 7095 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7096 |
|
| 7097 |
# Detailed Data Tables section removed as requested
|
| 7098 |
# 4. VISUALIZATIONS SECTION - Show if available (skip for Step 3)
|
|
@@ -7600,26 +7625,43 @@ def display_step5_economic_forecast(analysis_data):
|
|
| 7600 |
if all_tables_displayed == 0:
|
| 7601 |
if 'formatted_analysis' in analysis_data and analysis_data['formatted_analysis']:
|
| 7602 |
st.markdown(f"### 📊 **{t('economic_analysis_tables_formatted', 'Economic Analysis Tables (Formatted)')}**")
|
| 7603 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7604 |
display_formatted_economic_tables(analysis_data['formatted_analysis'])
|
| 7605 |
else:
|
| 7606 |
# Generate a basic economic summary if no data is available
|
| 7607 |
st.markdown(f"### 📊 **{t('economic_impact_analysis', 'Economic Impact Analysis')}**")
|
| 7608 |
-
|
| 7609 |
-
|
| 7610 |
-
|
| 7611 |
-
|
| 7612 |
-
|
| 7613 |
-
|
| 7614 |
-
|
| 7615 |
-
|
| 7616 |
-
|
| 7617 |
-
|
| 7618 |
-
|
| 7619 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7620 |
|
| 7621 |
# Show completion message
|
| 7622 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7623 |
|
| 7624 |
# CRITICAL: Ensure ALL tables are displayed (including non-economic ones)
|
| 7625 |
# This prevents tables from being missed in Step 5 display
|
|
@@ -7686,16 +7728,26 @@ def display_step5_economic_forecast(analysis_data):
|
|
| 7686 |
logger.error(f"Error in display_step5_economic_forecast: {str(e)}")
|
| 7687 |
st.error(f"Error displaying Step 5 economic forecast: {str(e)}")
|
| 7688 |
# Continue with basic economic summary as fallback
|
| 7689 |
-
st.markdown("### 📊 **Economic Impact Analysis**")
|
| 7690 |
-
|
| 7691 |
-
|
| 7692 |
-
|
| 7693 |
-
|
| 7694 |
-
|
| 7695 |
-
|
| 7696 |
-
|
| 7697 |
-
|
| 7698 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7699 |
|
| 7700 |
return # Exit immediately - no further processing
|
| 7701 |
|
|
@@ -7941,14 +7993,25 @@ def display_formatted_economic_tables(formatted_text):
|
|
| 7941 |
|
| 7942 |
# If no tables found after filtering, show a helpful message
|
| 7943 |
if not tables and not html_table_blocks:
|
| 7944 |
-
|
| 7945 |
-
|
| 7946 |
-
|
| 7947 |
-
|
| 7948 |
-
|
| 7949 |
-
|
| 7950 |
-
|
| 7951 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7952 |
return
|
| 7953 |
|
| 7954 |
for i, (title, table_content, format_type) in enumerate(tables):
|
|
@@ -8682,8 +8745,6 @@ def parse_and_display_json_analysis(json_text):
|
|
| 8682 |
st.markdown(f"### 📋 {t('detailed_analysis', 'Detailed Analysis')}")
|
| 8683 |
# Filter out known sections from raw text display
|
| 8684 |
filtered_text = filter_known_sections_from_text(json_text)
|
| 8685 |
-
# Translate headers in the text
|
| 8686 |
-
filtered_text = translate_text_headers(filtered_text)
|
| 8687 |
|
| 8688 |
# Additional check for corrupted soil issues data in fallback
|
| 8689 |
if ('"parameter": "pH"' in filtered_text and '"optimal_range": "4.0-5.5"' in filtered_text and
|
|
@@ -8700,8 +8761,6 @@ def parse_and_display_json_analysis(json_text):
|
|
| 8700 |
st.markdown(f"### 📋 {t('detailed_analysis', 'Detailed Analysis')}")
|
| 8701 |
# Filter out known sections from raw text display
|
| 8702 |
filtered_text = filter_known_sections_from_text(json_text)
|
| 8703 |
-
# Translate headers in the text
|
| 8704 |
-
filtered_text = translate_text_headers(filtered_text)
|
| 8705 |
|
| 8706 |
# Additional check for corrupted soil issues data in fallback
|
| 8707 |
if ('"parameter": "pH"' in filtered_text and '"optimal_range": "4.0-5.5"' in filtered_text and
|
|
@@ -8781,8 +8840,6 @@ def display_structured_analysis(data):
|
|
| 8781 |
elif value: # If it's not a list but has content
|
| 8782 |
# Filter out known sections from raw text display
|
| 8783 |
filtered_value = filter_known_sections_from_text(str(value))
|
| 8784 |
-
# Translate headers in the text
|
| 8785 |
-
filtered_value = translate_text_headers(filtered_value)
|
| 8786 |
st.markdown(filtered_value)
|
| 8787 |
|
| 8788 |
def display_economic_forecast(economic_forecast):
|
|
@@ -9206,7 +9263,10 @@ def display_step_block(step_result, step_number, step_title):
|
|
| 9206 |
6: {"color": "#000000", "icon": "📈", "description": "Yield Forecast & Projections"}
|
| 9207 |
}
|
| 9208 |
|
| 9209 |
-
config = step_configs.get(step_number, {"color": "#667eea", "icon": "📋", "description":
|
|
|
|
|
|
|
|
|
|
| 9210 |
|
| 9211 |
# Create a prominent step header with step-specific styling
|
| 9212 |
st.markdown(f"""
|
|
@@ -9229,7 +9289,7 @@ def display_step_block(step_result, step_number, step_title):
|
|
| 9229 |
margin-right: 20px;
|
| 9230 |
backdrop-filter: blur(10px);
|
| 9231 |
">
|
| 9232 |
-
{config['icon']}
|
| 9233 |
</div>
|
| 9234 |
<h2 style="color: white; margin: 0; font-size: 28px; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,0.3);">
|
| 9235 |
{step_title}
|
|
@@ -9740,8 +9800,6 @@ def display_enhanced_step_result(step_result, step_number):
|
|
| 9740 |
if original_filtered == "Content filtered to prevent raw LLM output display.":
|
| 9741 |
pass # Don't display anything
|
| 9742 |
else:
|
| 9743 |
-
# Translate headers in the text before displaying
|
| 9744 |
-
filtered_value = translate_text_headers(filtered_value)
|
| 9745 |
st.markdown(f"**{title}:** {filtered_value}")
|
| 9746 |
st.markdown("")
|
| 9747 |
|
|
@@ -9851,7 +9909,7 @@ def display_enhanced_step_result(step_result, step_number):
|
|
| 9851 |
# This catches any raw data that might have leaked through from LLM responses
|
| 9852 |
analysis_data = remove_economic_scenarios_from_analysis(analysis_data)
|
| 9853 |
|
| 9854 |
-
display_forecast_graph_content(analysis_data, step_number, step_result.get('step_title', f'Step {step_number}'))
|
| 9855 |
|
| 9856 |
# Also show Step 5 reference tables/text when available
|
| 9857 |
try:
|
|
@@ -14507,7 +14565,11 @@ def display_nutrient_gap_analysis_table(analysis_data):
|
|
| 14507 |
except Exception as e:
|
| 14508 |
logger.error(f"Nutrient gap analysis sorting failed: {e}")
|
| 14509 |
pass
|
| 14510 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14511 |
df = pd.DataFrame(rows)
|
| 14512 |
# Rename columns to match user expectations
|
| 14513 |
df = df.rename(columns={
|
|
@@ -16324,10 +16386,18 @@ def _extract_first_float(value, default_value=0.0):
|
|
| 16324 |
def display_forecast_graph_content(analysis_data, step_number=None, step_title=None):
|
| 16325 |
"""Display Forecast Graph content with baseline - works for any step with yield forecast data"""
|
| 16326 |
# Dynamic header based on step information
|
|
|
|
|
|
|
| 16327 |
if step_number and step_title:
|
| 16328 |
-
|
|
|
|
|
|
|
|
|
|
| 16329 |
else:
|
| 16330 |
-
|
|
|
|
|
|
|
|
|
|
| 16331 |
|
| 16332 |
# Styled header with updated background color
|
| 16333 |
st.markdown(
|
|
@@ -16743,7 +16813,7 @@ def display_economic_analysis(analysis_data):
|
|
| 16743 |
if not investment_scenarios:
|
| 16744 |
return
|
| 16745 |
|
| 16746 |
-
st.markdown("### 💹 Economic Impact Analysis")
|
| 16747 |
|
| 16748 |
# Create DataFrame for table display
|
| 16749 |
scenarios_data = []
|
|
@@ -16762,7 +16832,7 @@ def display_economic_analysis(analysis_data):
|
|
| 16762 |
st.dataframe(df, use_container_width=True)
|
| 16763 |
|
| 16764 |
# Summary metrics
|
| 16765 |
-
st.markdown("### 📊 Economic Summary")
|
| 16766 |
col1, col2, col3 = st.columns(3)
|
| 16767 |
|
| 16768 |
costs = [data.get('total_cost', 0) for data in investment_scenarios.values() if isinstance(data.get('total_cost', 0), (int, float))]
|
|
|
|
| 23 |
from modules.admin import get_active_prompt
|
| 24 |
from utils.feedback_system import (
|
| 25 |
display_feedback_section as display_feedback_section_util)
|
| 26 |
+
from utils.translations import t, get_language
|
| 27 |
|
| 28 |
# Import CropDrive integration for user ID
|
| 29 |
try:
|
|
|
|
| 168 |
try:
|
| 169 |
display_overall_results_summary_table(analysis_data)
|
| 170 |
except Exception as _e:
|
| 171 |
+
current_lang = get_language()
|
| 172 |
+
if current_lang == 'ms':
|
| 173 |
+
st.info("📋 Ringkasan Keputusan Ujian Tanah dan Daun Anda: Tiada data tersedia untuk dipaparkan.")
|
| 174 |
+
else:
|
| 175 |
+
st.info("📋 Your Soil and Leaf Test Results Summary: No data available to display.")
|
| 176 |
elif num == 1:
|
| 177 |
try:
|
| 178 |
display_soil_ratio_table(analysis_data)
|
| 179 |
except Exception:
|
| 180 |
+
current_lang = get_language()
|
| 181 |
+
if current_lang == 'ms':
|
| 182 |
+
st.info("📋 Nisbah Nutrien Tanah: Tiada data tersedia untuk dipaparkan.")
|
| 183 |
+
else:
|
| 184 |
+
st.info("📋 Soil Nutrient Ratios: No data available to display.")
|
| 185 |
elif num == 2:
|
| 186 |
try:
|
| 187 |
display_leaf_ratio_table(analysis_data)
|
| 188 |
except Exception:
|
| 189 |
+
current_lang = get_language()
|
| 190 |
+
if current_lang == 'ms':
|
| 191 |
+
st.info("📋 Nisbah Nutrien Daun: Tiada data tersedia untuk dipaparkan.")
|
| 192 |
+
else:
|
| 193 |
+
st.info("📋 Leaf Nutrient Ratios: No data available to display.")
|
| 194 |
elif num == 3:
|
| 195 |
try:
|
| 196 |
display_nutrient_gap_analysis_table(analysis_data)
|
| 197 |
except Exception:
|
| 198 |
+
current_lang = get_language()
|
| 199 |
+
if current_lang == 'ms':
|
| 200 |
+
st.info("📋 Analisis Jurang Nutrien: Tiada data tersedia untuk dipaparkan.")
|
| 201 |
+
else:
|
| 202 |
+
st.info("📋 Nutrient Gap Analysis: No data available to display.")
|
| 203 |
except Exception as e:
|
| 204 |
logger.error(f"Error rendering numbered table placeholder {num}: {e}")
|
| 205 |
|
|
|
|
| 2810 |
else:
|
| 2811 |
display_leaf_data_table(leaf_data)
|
| 2812 |
else:
|
| 2813 |
+
current_lang = get_language()
|
| 2814 |
+
if current_lang == 'ms':
|
| 2815 |
+
st.info("📋 Tiada data mentah tersedia untuk analisis ini.")
|
| 2816 |
+
else:
|
| 2817 |
+
st.info("📋 No raw data available for this analysis.")
|
| 2818 |
st.write(f"{t('results_data_keys', 'Results data keys')}: {list(results_data.keys())}")
|
| 2819 |
if analysis_results:
|
| 2820 |
st.write(f"{t('analysis_results_keys', 'Analysis results keys')}: {list(analysis_results.keys())}")
|
|
|
|
| 6305 |
continue
|
| 6306 |
|
| 6307 |
step_number = step_result.get('step_number', i+1)
|
| 6308 |
+
step_title = step_result.get('step_title', t(f'step_{step_number}_title', f'Step {step_number}'))
|
|
|
|
|
|
|
| 6309 |
|
| 6310 |
# Create a visual separator between steps
|
| 6311 |
if i > 0:
|
|
|
|
| 6602 |
|
| 6603 |
config = step_configs.get(step_number, {"color": "#667eea", "icon": "📋", "description": t('results_step_analysis', 'Analysis Step')})
|
| 6604 |
|
| 6605 |
+
# Get translated step prefix
|
| 6606 |
+
step_prefix = t('step_prefix', 'STEP')
|
| 6607 |
+
|
| 6608 |
# Create a prominent step header with step-specific styling
|
| 6609 |
st.markdown(f"""
|
| 6610 |
<div style="
|
|
|
|
| 6625 |
font-size: 18px;
|
| 6626 |
margin-right: 20px;
|
| 6627 |
">
|
| 6628 |
+
{config['icon']} {step_prefix} {step_number}
|
| 6629 |
</div>
|
| 6630 |
<div>
|
| 6631 |
<h3 style="color: white; margin: 0; font-size: 24px;">{step_title}</h3>
|
|
|
|
| 7113 |
if detailed_text.strip():
|
| 7114 |
parse_and_display_json_analysis(detailed_text)
|
| 7115 |
else:
|
| 7116 |
+
current_lang = get_language()
|
| 7117 |
+
if current_lang == 'ms':
|
| 7118 |
+
st.info("📋 Tiada analisis terperinci tersedia untuk langkah ini.")
|
| 7119 |
+
else:
|
| 7120 |
+
st.info("📋 No detailed analysis available for this step.")
|
| 7121 |
|
| 7122 |
# Detailed Data Tables section removed as requested
|
| 7123 |
# 4. VISUALIZATIONS SECTION - Show if available (skip for Step 3)
|
|
|
|
| 7625 |
if all_tables_displayed == 0:
|
| 7626 |
if 'formatted_analysis' in analysis_data and analysis_data['formatted_analysis']:
|
| 7627 |
st.markdown(f"### 📊 **{t('economic_analysis_tables_formatted', 'Economic Analysis Tables (Formatted)')}**")
|
| 7628 |
+
current_lang = get_language()
|
| 7629 |
+
if current_lang == 'ms':
|
| 7630 |
+
st.info("📋 Memaparkan analisis ekonomi terformat dari teks analisis.")
|
| 7631 |
+
else:
|
| 7632 |
+
st.info("📋 Displaying formatted economic analysis from analysis text.")
|
| 7633 |
display_formatted_economic_tables(analysis_data['formatted_analysis'])
|
| 7634 |
else:
|
| 7635 |
# Generate a basic economic summary if no data is available
|
| 7636 |
st.markdown(f"### 📊 **{t('economic_impact_analysis', 'Economic Impact Analysis')}**")
|
| 7637 |
+
current_lang = get_language()
|
| 7638 |
+
if current_lang == 'ms':
|
| 7639 |
+
st.info("💡 **Ringkasan Analisis Ekonomi:** Analisis menunjukkan potensi untuk peningkatan hasil melalui pengurusan nutrien yang betul. Lengkapkan analisis tanah dan daun pada langkah sebelumnya untuk menjana unjuran ekonomi yang terperinci.")
|
| 7640 |
+
st.markdown("""
|
| 7641 |
+
**Pertimbangan Ekonomi Utama:**
|
| 7642 |
+
- **Manfaat Pelaburan**: Pembetulan nutrien yang betul boleh meningkatkan hasil sebanyak 15-40%
|
| 7643 |
+
- **Potensi ROI**: Pelaburan baja biasanya memberikan pulangan 60-120% dalam 2-3 tahun
|
| 7644 |
+
- **Pemulihan Kos**: Kebanyakan program pembetulan membayar sendiri dalam 12-18 bulan
|
| 7645 |
+
- **Nilai Jangka Panjang**: Pengurusan nutrien yang mampan memastikan produktiviti ladang berterusan
|
| 7646 |
+
""")
|
| 7647 |
+
st.markdown("**💡 Cadangan:** Lengkapkan rangkaian analisis penuh (Langkah 1-4) untuk menjana unjuran ekonomi 5 tahun yang terperinci dengan kos, pendapatan dan pengiraan ROI yang spesifik.")
|
| 7648 |
+
else:
|
| 7649 |
+
st.info("💡 **Economic Analysis Summary:** The analysis indicates potential for yield improvements through proper nutrient management. Complete soil and leaf analysis in previous steps to generate detailed economic projections.")
|
| 7650 |
+
st.markdown("""
|
| 7651 |
+
**Key Economic Considerations:**
|
| 7652 |
+
- **Investment Benefits**: Proper nutrient correction can improve yields by 15-40%
|
| 7653 |
+
- **ROI Potential**: Fertilizer investments typically provide 60-120% returns within 2-3 years
|
| 7654 |
+
- **Cost Recovery**: Most corrective programs pay for themselves within 12-18 months
|
| 7655 |
+
- **Long-term Value**: Sustainable nutrient management ensures continued plantation productivity
|
| 7656 |
+
""")
|
| 7657 |
+
st.markdown("**💡 Recommendation:** Complete the full analysis suite (Steps 1-4) to generate detailed 5-year economic projections with specific costs, revenues, and ROI calculations.")
|
| 7658 |
|
| 7659 |
# Show completion message
|
| 7660 |
+
current_lang = get_language()
|
| 7661 |
+
if current_lang == 'ms':
|
| 7662 |
+
st.info("📊 **Analisis Kesan Ekonomi Selesai** - Semua unjuran dan pengiraan ROI dipaparkan dalam jadual di atas.")
|
| 7663 |
+
else:
|
| 7664 |
+
st.info("📊 **Economic Impact Analysis Complete** - All projections and ROI calculations are displayed in the tables above.")
|
| 7665 |
|
| 7666 |
# CRITICAL: Ensure ALL tables are displayed (including non-economic ones)
|
| 7667 |
# This prevents tables from being missed in Step 5 display
|
|
|
|
| 7728 |
logger.error(f"Error in display_step5_economic_forecast: {str(e)}")
|
| 7729 |
st.error(f"Error displaying Step 5 economic forecast: {str(e)}")
|
| 7730 |
# Continue with basic economic summary as fallback
|
| 7731 |
+
st.markdown(f"### 📊 **{t('economic_impact_analysis', 'Economic Impact Analysis')}**")
|
| 7732 |
+
current_lang = get_language()
|
| 7733 |
+
if current_lang == 'ms':
|
| 7734 |
+
st.info("💡 **Ringkasan Analisis Ekonomi:** Analisis menunjukkan potensi untuk peningkatan hasil melalui pengurusan nutrien yang betul.")
|
| 7735 |
+
st.markdown("""
|
| 7736 |
+
**Pertimbangan Ekonomi Utama:**
|
| 7737 |
+
- **Manfaat Pelaburan**: Pembetulan nutrien yang betul boleh meningkatkan hasil sebanyak 15-40%
|
| 7738 |
+
- **Potensi ROI**: Pelaburan baja biasanya memberikan pulangan 60-120% dalam 2-3 tahun
|
| 7739 |
+
- **Pemulihan Kos**: Kebanyakan program pembetulan membayar sendiri dalam 12-18 bulan
|
| 7740 |
+
- **Nilai Jangka Panjang**: Pengurusan nutrien yang mampan memastikan produktiviti ladang berterusan
|
| 7741 |
+
""")
|
| 7742 |
+
else:
|
| 7743 |
+
st.info("💡 **Economic Analysis Summary:** The analysis indicates potential for yield improvements through proper nutrient management.")
|
| 7744 |
+
st.markdown("""
|
| 7745 |
+
**Key Economic Considerations:**
|
| 7746 |
+
- **Investment Benefits**: Proper nutrient correction can improve yields by 15-40%
|
| 7747 |
+
- **ROI Potential**: Fertilizer investments typically provide 60-120% returns within 2-3 years
|
| 7748 |
+
- **Cost Recovery**: Most corrective programs pay for themselves within 12-18 months
|
| 7749 |
+
- **Long-term Value**: Sustainable nutrient management ensures continued plantation productivity
|
| 7750 |
+
""")
|
| 7751 |
|
| 7752 |
return # Exit immediately - no further processing
|
| 7753 |
|
|
|
|
| 7993 |
|
| 7994 |
# If no tables found after filtering, show a helpful message
|
| 7995 |
if not tables and not html_table_blocks:
|
| 7996 |
+
current_lang = get_language()
|
| 7997 |
+
if current_lang == 'ms':
|
| 7998 |
+
st.info("📊 **Ringkasan Analisis Ekonomi:** Analisis menunjukkan potensi untuk peningkatan hasil melalui pengurusan nutrien yang betul. Lengkapkan analisis tanah dan daun pada langkah sebelumnya untuk menjana unjuran ekonomi yang terperinci.")
|
| 7999 |
+
st.markdown("""
|
| 8000 |
+
**Pertimbangan Ekonomi Utama:**
|
| 8001 |
+
- **Manfaat Pelaburan**: Pembetulan nutrien yang betul boleh meningkatkan hasil sebanyak 15-40%
|
| 8002 |
+
- **Potensi ROI**: Pelaburan baja biasanya memberikan pulangan 60-120% dalam 2-3 tahun
|
| 8003 |
+
- **Pemulihan Kos**: Kebanyakan program pembetulan membayar sendiri dalam 12-18 bulan
|
| 8004 |
+
- **Nilai Jangka Panjang**: Pengurusan nutrien yang mampan memastikan produktiviti ladang berterusan
|
| 8005 |
+
""")
|
| 8006 |
+
else:
|
| 8007 |
+
st.info("📊 **Economic Analysis Summary:** The analysis indicates potential for yield improvements through proper nutrient management. Complete soil and leaf analysis in previous steps to generate detailed economic projections.")
|
| 8008 |
+
st.markdown("""
|
| 8009 |
+
**Key Economic Considerations:**
|
| 8010 |
+
- **Investment Benefits**: Proper nutrient correction can improve yields by 15-40%
|
| 8011 |
+
- **ROI Potential**: Fertilizer investments typically provide 60-120% returns within 2-3 years
|
| 8012 |
+
- **Cost Recovery**: Most corrective programs pay for themselves within 12-18 months
|
| 8013 |
+
- **Long-term Value**: Sustainable nutrient management ensures continued plantation productivity
|
| 8014 |
+
""")
|
| 8015 |
return
|
| 8016 |
|
| 8017 |
for i, (title, table_content, format_type) in enumerate(tables):
|
|
|
|
| 8745 |
st.markdown(f"### 📋 {t('detailed_analysis', 'Detailed Analysis')}")
|
| 8746 |
# Filter out known sections from raw text display
|
| 8747 |
filtered_text = filter_known_sections_from_text(json_text)
|
|
|
|
|
|
|
| 8748 |
|
| 8749 |
# Additional check for corrupted soil issues data in fallback
|
| 8750 |
if ('"parameter": "pH"' in filtered_text and '"optimal_range": "4.0-5.5"' in filtered_text and
|
|
|
|
| 8761 |
st.markdown(f"### 📋 {t('detailed_analysis', 'Detailed Analysis')}")
|
| 8762 |
# Filter out known sections from raw text display
|
| 8763 |
filtered_text = filter_known_sections_from_text(json_text)
|
|
|
|
|
|
|
| 8764 |
|
| 8765 |
# Additional check for corrupted soil issues data in fallback
|
| 8766 |
if ('"parameter": "pH"' in filtered_text and '"optimal_range": "4.0-5.5"' in filtered_text and
|
|
|
|
| 8840 |
elif value: # If it's not a list but has content
|
| 8841 |
# Filter out known sections from raw text display
|
| 8842 |
filtered_value = filter_known_sections_from_text(str(value))
|
|
|
|
|
|
|
| 8843 |
st.markdown(filtered_value)
|
| 8844 |
|
| 8845 |
def display_economic_forecast(economic_forecast):
|
|
|
|
| 9263 |
6: {"color": "#000000", "icon": "📈", "description": "Yield Forecast & Projections"}
|
| 9264 |
}
|
| 9265 |
|
| 9266 |
+
config = step_configs.get(step_number, {"color": "#667eea", "icon": "📋", "description": t('results_step_analysis', 'Analysis Step')})
|
| 9267 |
+
|
| 9268 |
+
# Get translated step prefix
|
| 9269 |
+
step_prefix = t('step_prefix', 'STEP')
|
| 9270 |
|
| 9271 |
# Create a prominent step header with step-specific styling
|
| 9272 |
st.markdown(f"""
|
|
|
|
| 9289 |
margin-right: 20px;
|
| 9290 |
backdrop-filter: blur(10px);
|
| 9291 |
">
|
| 9292 |
+
{config['icon']} {step_prefix} {step_number}
|
| 9293 |
</div>
|
| 9294 |
<h2 style="color: white; margin: 0; font-size: 28px; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,0.3);">
|
| 9295 |
{step_title}
|
|
|
|
| 9800 |
if original_filtered == "Content filtered to prevent raw LLM output display.":
|
| 9801 |
pass # Don't display anything
|
| 9802 |
else:
|
|
|
|
|
|
|
| 9803 |
st.markdown(f"**{title}:** {filtered_value}")
|
| 9804 |
st.markdown("")
|
| 9805 |
|
|
|
|
| 9909 |
# This catches any raw data that might have leaked through from LLM responses
|
| 9910 |
analysis_data = remove_economic_scenarios_from_analysis(analysis_data)
|
| 9911 |
|
| 9912 |
+
display_forecast_graph_content(analysis_data, step_number, step_result.get('step_title', t(f'step_{step_number}_title', f'Step {step_number}')))
|
| 9913 |
|
| 9914 |
# Also show Step 5 reference tables/text when available
|
| 9915 |
try:
|
|
|
|
| 14565 |
except Exception as e:
|
| 14566 |
logger.error(f"Nutrient gap analysis sorting failed: {e}")
|
| 14567 |
pass
|
| 14568 |
+
current_lang = get_language()
|
| 14569 |
+
if current_lang == 'ms':
|
| 14570 |
+
st.markdown("#### Jadual 3: Analisis Jurang Nutrien: Purata Ladang vs Standard MPOB")
|
| 14571 |
+
else:
|
| 14572 |
+
st.markdown("#### Table 3: Nutrient Gap Analysis: Plantation Average vs. MPOB Standards")
|
| 14573 |
df = pd.DataFrame(rows)
|
| 14574 |
# Rename columns to match user expectations
|
| 14575 |
df = df.rename(columns={
|
|
|
|
| 16386 |
def display_forecast_graph_content(analysis_data, step_number=None, step_title=None):
|
| 16387 |
"""Display Forecast Graph content with baseline - works for any step with yield forecast data"""
|
| 16388 |
# Dynamic header based on step information
|
| 16389 |
+
step_prefix = t('step_prefix', 'STEP')
|
| 16390 |
+
current_lang = get_language()
|
| 16391 |
if step_number and step_title:
|
| 16392 |
+
if current_lang == 'ms':
|
| 16393 |
+
header_title = f"📈 {step_prefix} {step_number} — {step_title}: Ramalan & Unjuran Hasil 5 Tahun"
|
| 16394 |
+
else:
|
| 16395 |
+
header_title = f"📈 {step_prefix} {step_number} — {step_title}: 5-Year Yield Forecast & Projections"
|
| 16396 |
else:
|
| 16397 |
+
if current_lang == 'ms':
|
| 16398 |
+
header_title = "📈 Ramalan & Unjuran Hasil 5 Tahun"
|
| 16399 |
+
else:
|
| 16400 |
+
header_title = "📈 5-Year Yield Forecast & Projections"
|
| 16401 |
|
| 16402 |
# Styled header with updated background color
|
| 16403 |
st.markdown(
|
|
|
|
| 16813 |
if not investment_scenarios:
|
| 16814 |
return
|
| 16815 |
|
| 16816 |
+
st.markdown(f"### 💹 {t('economic_impact_analysis', 'Economic Impact Analysis')}")
|
| 16817 |
|
| 16818 |
# Create DataFrame for table display
|
| 16819 |
scenarios_data = []
|
|
|
|
| 16832 |
st.dataframe(df, use_container_width=True)
|
| 16833 |
|
| 16834 |
# Summary metrics
|
| 16835 |
+
st.markdown(f"### 📊 {t('economic_summary', 'Economic Summary')}")
|
| 16836 |
col1, col2, col3 = st.columns(3)
|
| 16837 |
|
| 16838 |
costs = [data.get('total_cost', 0) for data in investment_scenarios.values() if isinstance(data.get('total_cost', 0), (int, float))]
|
utils/translations.py
CHANGED
|
@@ -236,6 +236,7 @@ TRANSLATIONS = {
|
|
| 236 |
|
| 237 |
# Economic Forecast Labels
|
| 238 |
'economic_forecast': 'Economic Forecast',
|
|
|
|
| 239 |
'economic_forecast_source': 'Economic Forecast Source',
|
| 240 |
'land_size_hectares': 'Land Size (Hectares)',
|
| 241 |
'current_yield_tonnes_ha': 'Current Yield (Tonnes/Ha)',
|
|
@@ -253,28 +254,15 @@ TRANSLATIONS = {
|
|
| 253 |
'months': 'months',
|
| 254 |
|
| 255 |
# Step Titles
|
| 256 |
-
'step_1_title': '
|
| 257 |
-
'step_2_title': '
|
| 258 |
-
'step_3_title': '
|
| 259 |
-
'step_4_title': '
|
| 260 |
-
'step_5_title': '
|
| 261 |
-
'step_6_title': '
|
| 262 |
|
| 263 |
-
#
|
| 264 |
-
'
|
| 265 |
-
'step_2_full_title': 'Step 2: Diagnose Agronomic Issues',
|
| 266 |
-
'step_3_full_title': 'Step 3: Recommend Solutions',
|
| 267 |
-
'step_4_full_title': 'Step 4: Regenerative Agriculture Strategies',
|
| 268 |
-
'step_5_full_title': 'Step 5: Economic Impact Forecast',
|
| 269 |
-
'step_6_full_title': 'Step 6: Forecast Graph',
|
| 270 |
-
|
| 271 |
-
# Step Title Patterns (for dynamic translation)
|
| 272 |
-
'step_1_pattern': 'Your soil and leaf test results and analysis',
|
| 273 |
-
'step_2_pattern': 'Diagnose Agronomic Issues',
|
| 274 |
-
'step_3_pattern': 'Recommend Solutions',
|
| 275 |
-
'step_4_pattern': 'Regenerative Agriculture Strategies',
|
| 276 |
-
'step_5_pattern': 'Economic Impact Forecast',
|
| 277 |
-
'step_6_pattern': 'Forecast Graph',
|
| 278 |
|
| 279 |
# Yield Forecast
|
| 280 |
'yield_forecast_title': 'Yield Forecast & Projections',
|
|
@@ -638,6 +626,7 @@ TRANSLATIONS = {
|
|
| 638 |
|
| 639 |
# Economic Forecast Labels (Malaysian)
|
| 640 |
'economic_forecast': 'Ramalan Ekonomi',
|
|
|
|
| 641 |
'economic_forecast_source': 'Sumber Ramalan Ekonomi',
|
| 642 |
'land_size_hectares': 'Saiz Tanah (Hektar)',
|
| 643 |
'current_yield_tonnes_ha': 'Hasil Semasa (Tan/Ha)',
|
|
@@ -655,28 +644,15 @@ TRANSLATIONS = {
|
|
| 655 |
'months': 'bulan',
|
| 656 |
|
| 657 |
# Step Titles (Malaysian)
|
| 658 |
-
'step_1_title': '
|
| 659 |
-
'step_2_title': '
|
| 660 |
-
'step_3_title': '
|
| 661 |
-
'step_4_title': '
|
| 662 |
-
'step_5_title': '
|
| 663 |
-
'step_6_title': '
|
| 664 |
-
|
| 665 |
-
# Extended Step Titles (for LLM-generated titles)
|
| 666 |
-
'step_1_full_title': 'Langkah 1: Keputusan Ujian Tanah dan Daun Anda dan Analisis',
|
| 667 |
-
'step_2_full_title': 'Langkah 2: Diagnosis Isu Agronomi',
|
| 668 |
-
'step_3_full_title': 'Langkah 3: Cadangan Penyelesaian',
|
| 669 |
-
'step_4_full_title': 'Langkah 4: Strategi Pertanian Regeneratif',
|
| 670 |
-
'step_5_full_title': 'Langkah 5: Ramalan Kesan Ekonomi',
|
| 671 |
-
'step_6_full_title': 'Langkah 6: Graf Ramalan',
|
| 672 |
|
| 673 |
-
# Step
|
| 674 |
-
'
|
| 675 |
-
'step_2_pattern': 'Diagnose Agronomic Issues',
|
| 676 |
-
'step_3_pattern': 'Recommend Solutions',
|
| 677 |
-
'step_4_pattern': 'Regenerative Agriculture Strategies',
|
| 678 |
-
'step_5_pattern': 'Economic Impact Forecast',
|
| 679 |
-
'step_6_pattern': 'Forecast Graph',
|
| 680 |
|
| 681 |
# Yield Forecast (Malaysian)
|
| 682 |
'yield_forecast_title': 'Ramalan & Unjuran Hasil',
|
|
@@ -1100,127 +1076,4 @@ def translate(key: str, default: str = None, **kwargs) -> str:
|
|
| 1100 |
|
| 1101 |
def t(key: str, default: str = None, **kwargs) -> str:
|
| 1102 |
"""Short alias for translate"""
|
| 1103 |
-
return translate(key, default, **kwargs)
|
| 1104 |
-
|
| 1105 |
-
def translate_step_title(step_title: str, step_number: int) -> str:
|
| 1106 |
-
"""
|
| 1107 |
-
Translate step title from English to current language if needed.
|
| 1108 |
-
Handles both generic titles and LLM-generated descriptive titles.
|
| 1109 |
-
"""
|
| 1110 |
-
if not step_title:
|
| 1111 |
-
return t(f'step_{step_number}_title', f'Step {step_number}')
|
| 1112 |
-
|
| 1113 |
-
lang = get_language()
|
| 1114 |
-
if lang == 'en':
|
| 1115 |
-
return step_title # Already in English
|
| 1116 |
-
|
| 1117 |
-
# Check if title matches known patterns and translate
|
| 1118 |
-
step_title_lower = step_title.lower()
|
| 1119 |
-
|
| 1120 |
-
# Pattern-based translation for common LLM-generated titles
|
| 1121 |
-
patterns = {
|
| 1122 |
-
1: {
|
| 1123 |
-
'en': ['your soil and leaf test results and analysis', 'soil and leaf test results'],
|
| 1124 |
-
'ms': t('step_1_full_title', 'Langkah 1: Keputusan Ujian Tanah dan Daun Anda dan Analisis')
|
| 1125 |
-
},
|
| 1126 |
-
2: {
|
| 1127 |
-
'en': ['diagnose agronomic issues', 'issue diagnosis'],
|
| 1128 |
-
'ms': t('step_2_full_title', 'Langkah 2: Diagnosis Isu Agronomi')
|
| 1129 |
-
},
|
| 1130 |
-
3: {
|
| 1131 |
-
'en': ['recommend solutions', 'solution recommendations'],
|
| 1132 |
-
'ms': t('step_3_full_title', 'Langkah 3: Cadangan Penyelesaian')
|
| 1133 |
-
},
|
| 1134 |
-
4: {
|
| 1135 |
-
'en': ['regenerative agriculture strategies', 'regenerative agriculture'],
|
| 1136 |
-
'ms': t('step_4_full_title', 'Langkah 4: Strategi Pertanian Regeneratif')
|
| 1137 |
-
},
|
| 1138 |
-
5: {
|
| 1139 |
-
'en': ['economic impact forecast', 'economic forecast'],
|
| 1140 |
-
'ms': t('step_5_full_title', 'Langkah 5: Ramalan Kesan Ekonomi')
|
| 1141 |
-
},
|
| 1142 |
-
6: {
|
| 1143 |
-
'en': ['forecast graph', 'yield forecast', 'forecast & projections'],
|
| 1144 |
-
'ms': t('step_6_full_title', 'Langkah 6: Graf Ramalan')
|
| 1145 |
-
}
|
| 1146 |
-
}
|
| 1147 |
-
|
| 1148 |
-
# Check if title matches any pattern for this step
|
| 1149 |
-
if step_number in patterns:
|
| 1150 |
-
for pattern in patterns[step_number]['en']:
|
| 1151 |
-
if pattern in step_title_lower:
|
| 1152 |
-
# Replace the English part with Malaysian translation
|
| 1153 |
-
# Try to preserve "Step X:" prefix if present
|
| 1154 |
-
if step_title_lower.startswith(f'step {step_number}') or step_title_lower.startswith(f'step {step_number}:'):
|
| 1155 |
-
return patterns[step_number]['ms']
|
| 1156 |
-
else:
|
| 1157 |
-
# Just return the full translated title
|
| 1158 |
-
return patterns[step_number]['ms']
|
| 1159 |
-
|
| 1160 |
-
# If no pattern match, try to translate common words
|
| 1161 |
-
# Replace "Step X:" with "Langkah X:"
|
| 1162 |
-
import re
|
| 1163 |
-
translated = re.sub(r'^Step\s+(\d+)[:\s]*', r'Langkah \1: ', step_title, flags=re.IGNORECASE)
|
| 1164 |
-
|
| 1165 |
-
# Common word replacements
|
| 1166 |
-
replacements = {
|
| 1167 |
-
'your soil and leaf test results and analysis': 'Keputusan Ujian Tanah dan Daun Anda dan Analisis',
|
| 1168 |
-
'diagnose agronomic issues': 'Diagnosis Isu Agronomi',
|
| 1169 |
-
'recommend solutions': 'Cadangan Penyelesaian',
|
| 1170 |
-
'regenerative agriculture strategies': 'Strategi Pertanian Regeneratif',
|
| 1171 |
-
'economic impact forecast': 'Ramalan Kesan Ekonomi',
|
| 1172 |
-
'forecast graph': 'Graf Ramalan',
|
| 1173 |
-
'yield forecast & projections': 'Ramalan & Unjuran Hasil',
|
| 1174 |
-
'data analysis': 'Analisis Data',
|
| 1175 |
-
'issue diagnosis': 'Diagnosis Isu',
|
| 1176 |
-
'solution recommendations': 'Cadangan Penyelesaian',
|
| 1177 |
-
'regenerative agriculture': 'Pertanian Regeneratif',
|
| 1178 |
-
}
|
| 1179 |
-
|
| 1180 |
-
for en_text, ms_text in replacements.items():
|
| 1181 |
-
if en_text.lower() in translated.lower():
|
| 1182 |
-
translated = re.sub(re.escape(en_text), ms_text, translated, flags=re.IGNORECASE)
|
| 1183 |
-
|
| 1184 |
-
# If translation didn't change much, use the default translated title
|
| 1185 |
-
if translated == step_title and lang == 'ms':
|
| 1186 |
-
return t(f'step_{step_number}_title', f'Langkah {step_number}')
|
| 1187 |
-
|
| 1188 |
-
return translated
|
| 1189 |
-
|
| 1190 |
-
def translate_text_headers(text: str) -> str:
|
| 1191 |
-
"""
|
| 1192 |
-
Translate common headers that appear in LLM output text.
|
| 1193 |
-
Handles headers like "Analysis:", "Summary:", "Formatted Analysis:", etc.
|
| 1194 |
-
"""
|
| 1195 |
-
if not text or not isinstance(text, str):
|
| 1196 |
-
return text
|
| 1197 |
-
|
| 1198 |
-
lang = get_language()
|
| 1199 |
-
if lang == 'en':
|
| 1200 |
-
return text # Already in English
|
| 1201 |
-
|
| 1202 |
-
import re
|
| 1203 |
-
|
| 1204 |
-
# Header translation patterns (case-insensitive)
|
| 1205 |
-
header_replacements = {
|
| 1206 |
-
r'\*\*Analysis:\*\*': f"**{t('analysis_label', 'Analisis:')}**",
|
| 1207 |
-
r'\*\*Analysis\*\*': f"**{t('analysis_label', 'Analisis:').rstrip(':')}**",
|
| 1208 |
-
r'^Analysis:\s*': f"{t('analysis_label', 'Analisis:')} ",
|
| 1209 |
-
r'\*\*Summary:\*\*': f"**{t('summary_label', 'Ringkasan:')}**",
|
| 1210 |
-
r'\*\*Summary\*\*': f"**{t('summary_label', 'Ringkasan:').rstrip(':')}**",
|
| 1211 |
-
r'^Summary:\s*': f"{t('summary_label', 'Ringkasan:')} ",
|
| 1212 |
-
r'\*\*Formatted Analysis:\*\*': f"**{t('formatted_analysis_label', 'Analisis Terformat:')}**",
|
| 1213 |
-
r'\*\*Formatted Analysis\*\*': f"**{t('formatted_analysis_label', 'Analisis Terformat:').rstrip(':')}**",
|
| 1214 |
-
r'^Formatted Analysis:\s*': f"{t('formatted_analysis_label', 'Analisis Terformat:')} ",
|
| 1215 |
-
r'\*\*Detailed Analysis:\*\*': f"**{t('detailed_analysis_label', 'Analisis Terperinci:')}**",
|
| 1216 |
-
r'\*\*Detailed Analysis\*\*': f"**{t('detailed_analysis_label', 'Analisis Terperinci:').rstrip(':')}**",
|
| 1217 |
-
r'^Detailed Analysis:\s*': f"{t('detailed_analysis_label', 'Analisis Terperinci:')} ",
|
| 1218 |
-
r'🔍\s*\*\*Detailed Interpretations\*\*': f"🔍 **{t('detailed_interpretations', 'Tafsiran Terperinci')}**",
|
| 1219 |
-
r'��\s*Detailed Interpretations': f"🔍 {t('detailed_interpretations', 'Tafsiran Terperinci')}",
|
| 1220 |
-
}
|
| 1221 |
-
|
| 1222 |
-
translated_text = text
|
| 1223 |
-
for pattern, replacement in header_replacements.items():
|
| 1224 |
-
translated_text = re.sub(pattern, replacement, translated_text, flags=re.IGNORECASE | re.MULTILINE)
|
| 1225 |
-
|
| 1226 |
-
return translated_text
|
|
|
|
| 236 |
|
| 237 |
# Economic Forecast Labels
|
| 238 |
'economic_forecast': 'Economic Forecast',
|
| 239 |
+
'economic_summary': 'Economic Summary',
|
| 240 |
'economic_forecast_source': 'Economic Forecast Source',
|
| 241 |
'land_size_hectares': 'Land Size (Hectares)',
|
| 242 |
'current_yield_tonnes_ha': 'Current Yield (Tonnes/Ha)',
|
|
|
|
| 254 |
'months': 'months',
|
| 255 |
|
| 256 |
# Step Titles
|
| 257 |
+
'step_1_title': 'Your Soil and Leaf Test Results and Analysis',
|
| 258 |
+
'step_2_title': 'Diagnose Agronomic Issues',
|
| 259 |
+
'step_3_title': 'Recommend Solutions',
|
| 260 |
+
'step_4_title': 'Regenerative Agriculture Strategies',
|
| 261 |
+
'step_5_title': 'Economic Impact Forecast',
|
| 262 |
+
'step_6_title': 'Forecast Graph',
|
| 263 |
|
| 264 |
+
# Step prefix for headers
|
| 265 |
+
'step_prefix': 'STEP',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
|
| 267 |
# Yield Forecast
|
| 268 |
'yield_forecast_title': 'Yield Forecast & Projections',
|
|
|
|
| 626 |
|
| 627 |
# Economic Forecast Labels (Malaysian)
|
| 628 |
'economic_forecast': 'Ramalan Ekonomi',
|
| 629 |
+
'economic_summary': 'Ringkasan Ekonomi',
|
| 630 |
'economic_forecast_source': 'Sumber Ramalan Ekonomi',
|
| 631 |
'land_size_hectares': 'Saiz Tanah (Hektar)',
|
| 632 |
'current_yield_tonnes_ha': 'Hasil Semasa (Tan/Ha)',
|
|
|
|
| 644 |
'months': 'bulan',
|
| 645 |
|
| 646 |
# Step Titles (Malaysian)
|
| 647 |
+
'step_1_title': 'Keputusan Ujian Tanah dan Daun Anda dan Analisis',
|
| 648 |
+
'step_2_title': 'Diagnosis Isu Agronomi',
|
| 649 |
+
'step_3_title': 'Cadangan Penyelesaian',
|
| 650 |
+
'step_4_title': 'Strategi Pertanian Regeneratif',
|
| 651 |
+
'step_5_title': 'Ramalan Kesan Ekonomi',
|
| 652 |
+
'step_6_title': 'Graf Ramalan',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 653 |
|
| 654 |
+
# Step prefix for headers (Malaysian)
|
| 655 |
+
'step_prefix': 'LANGKAH',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 656 |
|
| 657 |
# Yield Forecast (Malaysian)
|
| 658 |
'yield_forecast_title': 'Ramalan & Unjuran Hasil',
|
|
|
|
| 1076 |
|
| 1077 |
def t(key: str, default: str = None, **kwargs) -> str:
|
| 1078 |
"""Short alias for translate"""
|
| 1079 |
+
return translate(key, default, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|