+ .collect();
+ Ok(langs)
+ }
+
+ pub(crate) async fn to_language_id_single(
+ lang: Option<Self>,
+ pool: &mut DbPool<'_>,
+ ) -> Result<Option<LanguageId>, LemmyError> {
+ let identifier = lang.map(|l| l.identifier);
+ let language = Language::read_id_from_code(pool, identifier.as_deref()).await?;
+
+ Ok(language)
+ }
+
+ pub(crate) async fn to_language_id_multiple(
+ langs: Vec<Self>,
+ pool: &mut DbPool<'_>,
+ ) -> Result<Vec<LanguageId>, LemmyError> {
+ let mut language_ids = Vec::new();
+
+ for l in langs {
+ let id = l.identifier;
+ language_ids.push(Language::read_id_from_code(pool, Some(&id)).await?);