from pathlib import Path
root=Path('/home/ubuntu/clinic-management')
values={
'en': {'subscription_financial_chart':'Subscription revenue and collection forecast','subscription_financial_chart_intro':'Actual collections from recorded payments and expected renewals from active subscriptions.','actual_revenue':'Actual revenue','expected_collection':'Expected collection','forecast_next_six_months':'Forecast for the next six months','forecast_basis':'Forecast basis: active clinics and their current subscription value by expiry month.','no_financial_data':'No financial data available for the selected period.'},
'ar': {'subscription_financial_chart':'إيرادات الاشتراكات وتوقعات التحصيل','subscription_financial_chart_intro':'التحصيل الفعلي من المدفوعات المسجلة والتجديدات المتوقعة من الاشتراكات النشطة.','actual_revenue':'الإيراد الفعلي','expected_collection':'التحصيل المتوقع','forecast_next_six_months':'توقعات الأشهر الستة القادمة','forecast_basis':'أساس التوقع: العيادات المفعلة وقيمة اشتراكها الحالية حسب شهر انتهاء الاشتراك.','no_financial_data':'لا توجد بيانات مالية متاحة للفترة المحددة.'}
}
for locale, vals in values.items():
 p=root/f'lang/{locale}/ui.php';s=p.read_text();adds=[f"    '{k}' => '{v}'," for k,v in vals.items() if f"'{k}' =>" not in s]
 if adds:s=s.replace('\n];','\n'+'\n'.join(adds)+'\n];',1);p.write_text(s)
print('chart keys added')
