Aggiunge traduzioni it/en/fr/de/es agli avvisi e toglie gli override Android/iOS.
Un avviso ha un testo per lingua; per differenziare le piattaforme si creano due avvisi. L'app riceve già il copy risolto da Accept-Language. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -51,33 +51,22 @@ RSpec.describe AppAnnouncement do
|
||||
expect(described_class.for_app).to contain_exactly(android_item, ios_item)
|
||||
end
|
||||
|
||||
it "uses platform-specific copy and links when present" do
|
||||
it "serves translated copy and falls back to English then Italian" do
|
||||
item = create_notice!(
|
||||
title: "Comune",
|
||||
body: "Testo comune",
|
||||
action_url: "https://example.com/comune",
|
||||
action_label: "Apri",
|
||||
android_title: "Aggiorna su Android",
|
||||
android_body: "Apri Play Store",
|
||||
android_action_url: "https://play.google.com/store/apps/details?id=com.matchlivetv.match_live_tv",
|
||||
android_action_label: "Play Store",
|
||||
ios_title: "Aggiorna su iOS",
|
||||
ios_body: "Apri App Store",
|
||||
ios_action_url: "https://apps.apple.com/app/id000",
|
||||
ios_action_label: "App Store"
|
||||
title: "Titolo IT",
|
||||
body: "Testo IT",
|
||||
translations: {
|
||||
"en" => { "title" => "EN title", "body" => "EN body" },
|
||||
"de" => { "title" => "DE title", "body" => "DE body" }
|
||||
}
|
||||
)
|
||||
|
||||
android = item.as_api_json(platform: "android")
|
||||
ios = item.as_api_json(platform: "ios")
|
||||
|
||||
expect(android[:title]).to eq("Aggiorna su Android")
|
||||
expect(android[:body]).to eq("Apri Play Store")
|
||||
expect(android[:action_url]).to include("play.google.com")
|
||||
expect(android[:action_label]).to eq("Play Store")
|
||||
expect(ios[:title]).to eq("Aggiorna su iOS")
|
||||
expect(ios[:body]).to eq("Apri App Store")
|
||||
expect(ios[:action_url]).to include("apps.apple.com")
|
||||
expect(ios[:action_label]).to eq("App Store")
|
||||
expect(item.as_api_json(locale: :en)[:title]).to eq("EN title")
|
||||
expect(item.as_api_json(locale: :de)[:title]).to eq("DE title")
|
||||
expect(item.as_api_json(locale: :fr)[:title]).to eq("EN title")
|
||||
expect(item.as_api_json(locale: :it)[:title]).to eq("Titolo IT")
|
||||
expect(item.filled_locale_codes).to include("it", "en", "de")
|
||||
expect(item.filled_locale_codes).not_to include("fr")
|
||||
end
|
||||
|
||||
it "requires at least one channel" do
|
||||
|
||||
Reference in New Issue
Block a user