mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 09:16:54 +00:00
feat: Add country names to installation process (#501)
Fixes #494 Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/501 Reviewed-by: Inex Code <inex.code@selfprivacy.org> Co-authored-by: NaiJi ✨ <naiji@noreply.git.selfprivacy.org> Co-committed-by: NaiJi ✨ <naiji@noreply.git.selfprivacy.org>
This commit is contained in:
parent
ffdb9d92fb
commit
6819192219
|
@ -606,5 +606,16 @@
|
||||||
"reset_onboarding": "Reset onboarding switch",
|
"reset_onboarding": "Reset onboarding switch",
|
||||||
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
|
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
|
||||||
"cubit_statuses": "Cubit loading statuses"
|
"cubit_statuses": "Cubit loading statuses"
|
||||||
|
},
|
||||||
|
"countries": {
|
||||||
|
"germany": "Germany",
|
||||||
|
"netherlands": "Netherlands",
|
||||||
|
"singapore": "Singapore",
|
||||||
|
"united_kingdom": "United Kingdom",
|
||||||
|
"canada": "Canada",
|
||||||
|
"india": "India",
|
||||||
|
"australia": "Australia",
|
||||||
|
"united_states": "United States",
|
||||||
|
"finland": "Finland"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -65,14 +65,59 @@ class DigitalOceanLocation {
|
||||||
emoji = '🇮🇳';
|
emoji = '🇮🇳';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'syd':
|
||||||
|
emoji = '🇦🇺';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'nyc':
|
case 'nyc':
|
||||||
case 'sfo':
|
case 'sfo':
|
||||||
emoji = '🇺🇸';
|
emoji = '🇺🇸';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return emoji;
|
return emoji;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get countryDisplayKey {
|
||||||
|
String displayKey = 'countries.';
|
||||||
|
switch (slug.substring(0, 3)) {
|
||||||
|
case 'fra':
|
||||||
|
displayKey += 'germany';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ams':
|
||||||
|
displayKey += 'netherlands';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'sgp':
|
||||||
|
displayKey += 'singapore';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'lon':
|
||||||
|
displayKey += 'united_kingdom';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'tor':
|
||||||
|
displayKey += 'canada';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'blr':
|
||||||
|
displayKey += 'india';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'syd':
|
||||||
|
displayKey += 'australia';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'nyc':
|
||||||
|
case 'sfo':
|
||||||
|
displayKey += 'united_states';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
displayKey = slug;
|
||||||
|
}
|
||||||
|
return displayKey;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
|
@ -155,6 +155,27 @@ class HetznerLocation {
|
||||||
}
|
}
|
||||||
return emoji;
|
return emoji;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get countryDisplayKey {
|
||||||
|
String displayKey = 'countries.';
|
||||||
|
switch (country.substring(0, 2)) {
|
||||||
|
case 'DE':
|
||||||
|
displayKey += 'germany';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'FI':
|
||||||
|
displayKey += 'finland';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'US':
|
||||||
|
displayKey += 'united_states';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
displayKey = country;
|
||||||
|
}
|
||||||
|
return displayKey;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A Volume is a highly-available, scalable, and SSD-based block storage for Servers.
|
/// A Volume is a highly-available, scalable, and SSD-based block storage for Servers.
|
||||||
|
|
|
@ -2,12 +2,14 @@ class ServerProviderLocation {
|
||||||
ServerProviderLocation({
|
ServerProviderLocation({
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.identifier,
|
required this.identifier,
|
||||||
|
required this.countryDisplayKey,
|
||||||
this.description,
|
this.description,
|
||||||
this.flag = '',
|
this.flag = '',
|
||||||
});
|
});
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final String identifier;
|
final String identifier;
|
||||||
|
final String countryDisplayKey;
|
||||||
final String? description;
|
final String? description;
|
||||||
final String flag;
|
final String flag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,6 +438,7 @@ class DigitalOceanServerProvider extends ServerProvider {
|
||||||
description: rawLocation.name,
|
description: rawLocation.name,
|
||||||
flag: rawLocation.flag,
|
flag: rawLocation.flag,
|
||||||
identifier: rawLocation.slug,
|
identifier: rawLocation.slug,
|
||||||
|
countryDisplayKey: rawLocation.countryDisplayKey,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -156,6 +156,7 @@ class HetznerServerProvider extends ServerProvider {
|
||||||
description: server.location.description,
|
description: server.location.description,
|
||||||
flag: server.location.flag,
|
flag: server.location.flag,
|
||||||
identifier: server.location.name,
|
identifier: server.location.name,
|
||||||
|
countryDisplayKey: server.location.countryDisplayKey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -456,6 +457,7 @@ class HetznerServerProvider extends ServerProvider {
|
||||||
description: rawLocation.description,
|
description: rawLocation.description,
|
||||||
flag: rawLocation.flag,
|
flag: rawLocation.flag,
|
||||||
identifier: rawLocation.name,
|
identifier: rawLocation.name,
|
||||||
|
countryDisplayKey: rawLocation.countryDisplayKey,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -120,6 +120,14 @@ class SelectLocationPage extends StatelessWidget {
|
||||||
.titleMedium,
|
.titleMedium,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
location.countryDisplayKey.tr(),
|
||||||
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.bodyMedium,
|
||||||
|
),
|
||||||
|
if (location.description != null)
|
||||||
|
const SizedBox(height: 4),
|
||||||
if (location.description != null)
|
if (location.description != null)
|
||||||
Text(
|
Text(
|
||||||
location.description!,
|
location.description!,
|
||||||
|
|
Loading…
Reference in a new issue