Hungarian error messages; visible focus on input fields
CI / test (push) Successful in 1m47s
CI / build (push) Successful in 10m21s
CI / deploy (push) Skipped

- The browser's own form checks (required, minLength, e-mail format) show
  Hungarian text on every page (ValidationMessages in the root layout).
- User-facing backend errors are Hungarian: e-mail/password login, password
  length, links, invitations, sharing, questions, limits. Google/Apple token
  failures log the reason and tell the user to retry.
- errorText covers not_found, horoscope_unavailable and internal errors.
- Input fields: lighter background and gold caret on focus, the example text
  steps aside, so a click visibly lands in the field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-22 10:14:15 +00:00
co-authored by Claude Opus 5.5
parent 4b93dc42e8
commit 9716f503bc
15 changed files with 139 additions and 31 deletions
+2 -2
View File
@@ -113,9 +113,9 @@ pub async fn change_password(
.await?;
if let Some((hash,)) = existing {
let current =
req.current_password.ok_or_else(|| ApiError::BadRequest("current_password is required".into()))?;
req.current_password.ok_or_else(|| ApiError::BadRequest("Add meg a jelenlegi jelszavadat.".into()))?;
if !verify_password(current, hash).await? {
return Err(ApiError::InvalidCredentials("the current password is wrong".into()));
return Err(ApiError::InvalidCredentials("A jelenlegi jelszó hibás.".into()));
}
}
let hash = hash_password(req.new_password).await?;
+5 -3
View File
@@ -45,7 +45,7 @@ pub fn normalize_email(email: &str) -> Result<String, ApiError> {
!local.is_empty() && domain.contains('.') && !domain.starts_with('.') && !domain.ends_with('.')
})
&& !email.chars().any(char::is_whitespace);
if valid { Ok(email) } else { Err(ApiError::BadRequest("invalid e-mail address".into())) }
if valid { Ok(email) } else { Err(ApiError::BadRequest("Érvénytelen e-mail-cím.".into())) }
}
pub fn validate_locale(state: &AppState, locale: Option<&str>) -> Result<String, ApiError> {
@@ -288,7 +288,7 @@ pub async fn login(
WithRejection(Json(req), _): Body<LoginRequest>,
) -> ApiResult<impl IntoResponse> {
password_login_enabled(&state)?;
let invalid = || ApiError::InvalidCredentials("wrong e-mail address or password".into());
let invalid = || ApiError::InvalidCredentials("Hibás e-mail-cím vagy jelszó.".into());
let email = normalize_email(&req.email).map_err(|_| invalid())?;
state.login_limiter.check(&email)?;
@@ -405,7 +405,9 @@ async fn social_login(
let email = match (claims.email.as_deref(), claims.email_verified) {
(Some(e), true) => normalize_email(e)?,
_ => {
return Err(ApiError::InvalidCredentials(format!("the {provider} account has no verified e-mail address")));
return Err(ApiError::InvalidCredentials(format!(
"A {provider}-fiókodhoz nem tartozik megerősített e-mail-cím."
)));
}
};
+1 -1
View File
@@ -42,7 +42,7 @@ pub async fn places(
) -> ApiResult<Json<Value>> {
let q = query.q.trim();
if !valid_country(&query.country) || q.chars().count() < 2 || q.chars().count() > 80 {
return Err(ApiError::BadRequest("a country code and 2 to 80 characters of a place name are needed".into()));
return Err(ApiError::BadRequest("Válassz országot, és írj be 2–80 karaktert a település nevéből.".into()));
}
state.places_limiter.hit(&visitor(&headers))?;
Ok(Json(state.horoscope.places(&query.country, q, query.limit.unwrap_or(8).min(10)).await?))
+2 -2
View File
@@ -97,7 +97,7 @@ pub async fn primary_chart(db: &PgPool, owner: Uuid) -> Result<Option<ChartRow>,
fn clean_label(label: &str) -> Result<String, ApiError> {
let label: String = label.trim().chars().take(100).collect();
if label.is_empty() { Err(ApiError::BadRequest("label must not be empty".into())) } else { Ok(label) }
if label.is_empty() { Err(ApiError::BadRequest("A név nem lehet üres.".into())) } else { Ok(label) }
}
pub async fn list(State(state): St, auth: AuthUser) -> ApiResult<Json<Value>> {
@@ -195,7 +195,7 @@ pub async fn create(
if count >= state.config.max_charts_per_user {
return Err(ApiError::conflict(
"chart_limit_reached",
format!("at most {} charts can be saved", state.config.max_charts_per_user),
format!("Legfeljebb {} képletet lehet menteni.", state.config.max_charts_per_user),
));
}
let free = state.config.free_person_slots;
+1 -1
View File
@@ -221,7 +221,7 @@ pub async fn create(
if count >= MAX_PER_CHART && !is_admin(&auth) {
return Err(ApiError::conflict(
"forecast_limit_reached",
format!("at most {MAX_PER_CHART} forecasts can be saved for a chart"),
format!("Egy képlethez legfeljebb {MAX_PER_CHART} előrejelzés menthető."),
));
}
+2 -2
View File
@@ -115,7 +115,7 @@ pub async fn ask(
return Err(ApiError::NotFound("analysis"));
}
if !ASKABLE.contains(&analysis.kind.as_str()) {
return Err(ApiError::BadRequest("questions can be asked about a detailed analysis or a forecast".into()));
return Err(ApiError::BadRequest("Kérdést részletes elemzésről vagy előrejelzésről lehet feltenni.".into()));
}
if analysis.status != "done" {
return Err(ApiError::conflict("analysis_not_ready", "Az elemzés még nem készült el."));
@@ -123,7 +123,7 @@ pub async fn ask(
let question = req.question.trim().replace("\r\n", "\n");
let length = question.chars().count();
if !(3..=QUESTION_MAX_CHARS).contains(&length) {
return Err(ApiError::BadRequest(format!("the question must be 3 to {QUESTION_MAX_CHARS} characters long")));
return Err(ApiError::BadRequest(format!("A kérdés 3–{QUESTION_MAX_CHARS} karakter hosszú lehet.")));
}
let (open, total): (i64, i64) = sqlx::query_as(
"SELECT count(*) FILTER (WHERE status IN ('pending', 'running')), count(*) FROM questions WHERE analysis_id = $1",
+1 -1
View File
@@ -155,7 +155,7 @@ pub async fn create(
return Err(ApiError::NotFound("analysis"));
}
if analysis.status != "done" {
return Err(ApiError::conflict("analysis_not_ready", "only finished analyses can be shared"));
return Err(ApiError::conflict("analysis_not_ready", "Csak elkészült elemzést lehet megosztani."));
}
(None, None, Some(req.target_id), "analysis")
}
+8 -8
View File
@@ -210,7 +210,7 @@ pub async fn create(
WithRejection(Json(req), _): Body<CreateSynastry>,
) -> ApiResult<(StatusCode, Json<Value>)> {
if req.chart1_id == req.chart2_id {
return Err(ApiError::BadRequest("a chart cannot be compared with itself".into()));
return Err(ApiError::BadRequest("Egy képletet önmagával nem lehet összevetni.".into()));
}
let chart1 = owned_chart(&state.db, req.chart1_id, auth.id()).await?;
let chart2 = owned_chart(&state.db, req.chart2_id, auth.id()).await?;
@@ -249,9 +249,9 @@ pub struct CreateInvite {
async fn chart_or_primary(db: &PgPool, chart_id: Option<Uuid>, user: Uuid) -> Result<ChartRow, ApiError> {
match chart_id {
Some(id) => owned_chart(db, id, user).await,
None => primary_chart(db, user).await?.ok_or_else(|| {
ApiError::conflict("primary_chart_required", "create your own chart first (is_primary: true)")
}),
None => primary_chart(db, user)
.await?
.ok_or_else(|| ApiError::conflict("primary_chart_required", "Előbb add meg a saját születési adataidat.")),
}
}
@@ -459,12 +459,12 @@ pub async fn accept_invite(
) -> ApiResult<(StatusCode, Json<Value>)> {
let invite = invite_by_token(&state.db, &req.token).await?;
match invite_status(invite.accepted_at, invite.expires_at) {
"accepted" => return Err(ApiError::Gone("this invitation has already been accepted".into())),
"expired" => return Err(ApiError::Gone("this invitation has expired".into())),
"accepted" => return Err(ApiError::Gone("Ezt a meghívót már elfogadták.".into())),
"expired" => return Err(ApiError::Gone("Ez a meghívó lejárt.".into())),
_ => {}
}
if invite.inviter_id == auth.id() {
return Err(ApiError::conflict("own_invitation", "you cannot accept your own invitation"));
return Err(ApiError::conflict("own_invitation", "A saját meghívódat nem fogadhatod el."));
}
let my_chart = chart_or_primary(&state.db, req.chart_id, auth.id()).await?;
let inviter_chart =
@@ -489,7 +489,7 @@ pub async fn accept_invite(
if created {
sqlx::query("DELETE FROM synastries WHERE id = $1").bind(row.id).execute(&state.db).await?;
}
return Err(ApiError::Gone("this invitation has already been accepted".into()));
return Err(ApiError::Gone("Ezt a meghívót már elfogadták.".into()));
}
let inviter: Option<db::User> = sqlx::query_as(&format!("SELECT {USER_COLUMNS} FROM users WHERE id = $1"))
.bind(invite.inviter_id)