mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 09:03:31 +07:00
Use current base path for en-us and all other fallback content, step 1
(cherry picked from commit b872efa164618a45376871ea484ca150d49d0fdc) IJ-MR-176799 GitOrigin-RevId: 7ba79d3cb26b393fcc0b7d74431b28c8c6cdac6c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bdb3dba846
commit
e7325cf896
@@ -18,7 +18,12 @@ import java.lang.String.valueOf
|
||||
import java.net.*
|
||||
import java.nio.charset.StandardCharsets
|
||||
|
||||
val LOG = Logger.getInstance(BuiltInHelpManager::class.java)
|
||||
val LOG: Logger = Logger.getInstance(BuiltInHelpManager::class.java)
|
||||
|
||||
//Later we'll add more languages here, for now it's Chinese only
|
||||
val localesToUrls = mapOf(
|
||||
"zh-cn" to "zh-cn",
|
||||
)
|
||||
|
||||
class BuiltInHelpManager : HelpManager() {
|
||||
|
||||
@@ -70,15 +75,14 @@ class BuiltInHelpManager : HelpManager() {
|
||||
else
|
||||
"&keymap=${URLEncoder.encode(activeKeymap.presentableName, StandardCharsets.UTF_8)}"
|
||||
|
||||
//Later we'll add more languages here, for now it's either Chinese or English default
|
||||
val langToUrl = mapOf(
|
||||
"zh" to "zh-cn",
|
||||
)
|
||||
//Determine if we need to try loading localized docs first
|
||||
val selectedLocale = LocalizationStateService.getInstance()?.selectedLocale?.lowercase()
|
||||
val langPart = if (localesToUrls.containsKey(selectedLocale)) {
|
||||
"/" + localesToUrls[selectedLocale]
|
||||
}
|
||||
else ""
|
||||
|
||||
val selectedLocale = LocalizationStateService.getInstance()?.selectedLocale
|
||||
|
||||
val langPart = langToUrl[selectedLocale] ?: "en-us"
|
||||
"http://127.0.0.1:${BuiltInServerOptions.getInstance().effectiveBuiltInServerPort}/${langPart}/help/?${
|
||||
"http://127.0.0.1:${BuiltInServerOptions.getInstance().effectiveBuiltInServerPort}${langPart}/help/?${
|
||||
helpIdToUse
|
||||
}$activeKeymapParam"
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ abstract class HelpRequestHandlerBase : HttpRequestHandler() {
|
||||
}
|
||||
|
||||
fun getRequestLocalePath(request: HttpRequest): String {
|
||||
val requestLocale = request.uri().substringBefore(prefix).substringBeforeLast("/")
|
||||
val requestLocale = request.uri().substringBefore(prefix).substringAfter("/")
|
||||
return if (supportedLocales.contains(requestLocale)) requestLocale else ""
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user