org.comect.misc.dataschema.settings.Utils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of library Show documentation
Show all versions of library Show documentation
Library for transforming data files into data class-equivalents in various languages
The newest version!
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package org.comect.misc.dataschema.settings
import org.comect.misc.dataschema.getResources
private var languageCache: Map = mutableMapOf()
public fun getLanguages(reload: Boolean = false): Map {
if (reload || languageCache.isEmpty()) {
val languages = getResources("languages")
.filter { "." !in it }
.map { it.trim('/') }
val newCache = mutableMapOf()
languages.forEach { name ->
val settings = LanguageSettings.load(name)
if (settings != null) {
newCache[settings.name] = settings
}
}
languageCache = newCache
}
return languageCache
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy