Skip to content

Commit ffc684a

Browse files
committed
Локализация сообщений
1 parent 93ebc1f commit ffc684a

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

src/main/java/com/github/_1c_syntax/bsl/languageserver/WorkDoneProgressHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public class WorkDoneProgressHelper {
4848
private boolean isWorkDoneProgressSupported;
4949

5050
public WorkDoneProgressReporter createProgress(int size, String messagePostfix) {
51-
5251
isWorkDoneProgressSupported = clientCapabilitiesHolder.getCapabilities()
5352
.map(ClientCapabilities::getWindow)
5453
.map(WindowClientCapabilities::getWorkDoneProgress)

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContext.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
package com.github._1c_syntax.bsl.languageserver.context;
2323

2424
import com.github._1c_syntax.bsl.languageserver.WorkDoneProgressHelper;
25+
import com.github._1c_syntax.bsl.languageserver.configuration.LanguageServerConfiguration;
2526
import com.github._1c_syntax.bsl.languageserver.utils.MdoRefBuilder;
27+
import com.github._1c_syntax.bsl.languageserver.utils.Resources;
2628
import com.github._1c_syntax.bsl.types.ModuleType;
2729
import com.github._1c_syntax.mdclasses.Configuration;
2830
import com.github._1c_syntax.utils.Absolute;
@@ -58,6 +60,8 @@
5860
public class ServerContext {
5961
private final ObjectProvider<DocumentContext> documentContextProvider;
6062
private final WorkDoneProgressHelper workDoneProgressHelper;
63+
private final LanguageServerConfiguration languageServerConfiguration;
64+
6165
private final Map<URI, DocumentContext> documents = Collections.synchronizedMap(new HashMap<>());
6266
private final Lazy<Configuration> configurationMetadata = new Lazy<>(this::computeConfigurationMetadata);
6367
@CheckForNull
@@ -75,7 +79,7 @@ public void populateContext() {
7579
}
7680

7781
var workDoneProgressReporter = workDoneProgressHelper.createProgress(0, "");
78-
workDoneProgressReporter.beginProgress("Finding files to populate context...");
82+
workDoneProgressReporter.beginProgress(getMessage("populateFindFiles"));
7983

8084
LOGGER.debug("Finding files to populate context...");
8185
var files = (List<File>) FileUtils.listFiles(
@@ -89,7 +93,7 @@ public void populateContext() {
8993

9094
public void populateContext(List<File> files) {
9195
var workDoneProgressReporter = workDoneProgressHelper.createProgress(files.size(), " files");
92-
workDoneProgressReporter.beginProgress("Populating context...");
96+
workDoneProgressReporter.beginProgress(getMessage("populatePopulatingContext"));
9397

9498
LOGGER.debug("Populating context...");
9599
contextLock.writeLock().lock();
@@ -108,7 +112,7 @@ public void populateContext(List<File> files) {
108112

109113
contextLock.writeLock().unlock();
110114

111-
workDoneProgressReporter.endProgress("Context populated.");
115+
workDoneProgressReporter.endProgress(getMessage("populateContextPopulated"));
112116
LOGGER.debug("Context populated.");
113117
}
114118

@@ -201,6 +205,9 @@ private Configuration computeConfigurationMetadata() {
201205
return Configuration.create();
202206
}
203207

208+
var progress = workDoneProgressHelper.createProgress(0, "");
209+
progress.beginProgress(getMessage("computeConfigurationMetadata"));
210+
204211
Configuration configuration;
205212
var executorService = Executors.newCachedThreadPool();
206213
try {
@@ -216,6 +223,8 @@ private Configuration computeConfigurationMetadata() {
216223
executorService.shutdown();
217224
}
218225

226+
progress.endProgress(getMessage("computeConfigurationMetadataDone"));
227+
219228
return configuration;
220229
}
221230

@@ -242,4 +251,8 @@ private void removeDocumentMdoRefByUri(URI uri) {
242251
mdoRefs.remove(uri);
243252
}
244253
}
254+
255+
private String getMessage(String key) {
256+
return Resources.getResourceString(languageServerConfiguration.getLanguage(), getClass(), key);
257+
}
245258
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
computeConfigurationMetadata=Computing configuration metadata...
2+
computeConfigurationMetadataDone=Configuration metadata computing is finished.
3+
populateContextPopulated=Context populated.
4+
populateFindFiles=Finding files to populate context...
5+
populatePopulatingContext=Populating context...
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
populateContextPopulated=Наполнение контекста завершено.
2+
populateFindFiles=Ищем файлы для наполнения контекста...populatePopulatingContext=Наполняем контекст...
3+
populatePopulatingContext=Наполняем контекст...
4+
computeConfigurationMetadata=Рассчитываем данные конфигурации...\
5+
computeConfigurationMetadataDone=Расчет метаданных конфигурации завершен.
6+
computeConfigurationMetadataDone=Расчет метаданных конфигурации завершен.

0 commit comments

Comments
 (0)