-
Notifications
You must be signed in to change notification settings - Fork 39
[DRAFT] multi-language support: sync nodeView with FilterOptionsPopup #823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Adding comments from the original ticket here for additional context: 9/26/2025 from Jose Pereda: Added a Draft PR: #823 I didn't get to fix the above issue, so it is not working, but everything is more or less set to pick it up when time permits and the issue gets solved. 9/25/2025 from Jose Pereda: I'm trying this now, just directly over the ConceptNavigator View, in ConceptPatternNavController::loadConceptNavigatorPanel, outside the FilterOptionsPopup and all the listeners: private Pane loadConceptNavigatorPanel() {
ViewProperties viewProperties = patternNavViewModel.getPropertyValue(VIEW_PROPERTIES);
ObservableViewWithOverride viewCoordinate = viewProperties.nodeView();
# When the view is created, we should only have English:
System.out.println("init, view has lang: " + viewCoordinate.getValue().languageCoordinateList().stream().map(l -> l.languageConcept().description()).toList());
ImmutableList<LanguageCoordinateRecord> languageCoordinateRecords = viewCoordinate.getValue().languageCoordinateList();
MutableList<LanguageCoordinateRecord> languageRecordList = Lists.mutable.empty();
languageCoordinateRecords.forEach(languageRecordList::add);
LanguageCoordinateRecord coordinateRecord = Coordinates.Language.SpanishFullyQualifiedName();
languageRecordList.add(coordinateRecord);
ViewCoordinateRecord viewCoordinateRecord = ViewCoordinateRecord.make(
viewCoordinate.stampCoordinate().toStampCoordinateRecord(),
languageRecordList,
viewCoordinate.logicCoordinate().toLogicCoordinateRecord(),
viewCoordinate.navigationCoordinate().toNavigationCoordinateRecord(),
viewCoordinate.editCoordinate().toEditCoordinateRecord());
// the new record should have English and Spanish:
System.out.println("viewCoordinateRecord = " + viewCoordinateRecord.languageCoordinateList().stream().map(l -> l.languageConcept().description()).toList());
// add a subscriber to check the changes:
viewCoordinate.subscribe((_, nv) ->
System.out.println("viewCoordinate changed to = " + nv.languageCoordinateList().stream().map(l -> l.languageConcept().description()).toList()));
// set the view:
viewCoordinate.setValue(viewCoordinateRecord);
// In theory, the view should have now two languages, but it only keeps English???
System.out.println("done, view has lang: " + viewCoordinate.getValue().languageCoordinateList().stream().map(l -> l.languageConcept().description()).toList());
...and I get this output: init, view has lang: [English language]
viewCoordinateRecord = [English language, Spanish language]
viewCoordinate changed to = [English language, Spanish language]
done, view has lang: [English language]Am I doing anything wrong? Why the view seems to get the two languages, but then it keeps only the first language? I can see that the internal viewCalculator (see ObservableViewBase) gets updated because of the change listener: private ViewCalculator viewCalculator;
public ObservableViewBase(ViewCoordinate viewRecord, String name) {
super(viewRecord.toViewCoordinateRecord(), name != null ? name : DEFAULT_VIEW_NAME);
this.stampCoordinateObservable = makeStampCoordinateObservable(viewRecord);
this.navigationCoordinateObservable = makeNavigationCoordinateObservable(viewRecord);
this.languageCoordinates = makeLanguageCoordinateListProperty(viewRecord);
this.logicCoordinateObservable = makeLogicCoordinateObservable(viewRecord);
this.editCoordinateObservable = makeEditCoordinateObservable(viewRecord);
addListeners();
this.viewCalculator = ViewCalculatorWithCache.getCalculator(viewRecord.toViewCoordinateRecord());
addListener((observable, oldValue, newValue) -> {
// this gets updated with two languages after a new record is set!!
this.viewCalculator = ViewCalculatorWithCache.getCalculator(newValue);
});
} but not the rest of the properties... 9/24/2025 from Jose Pereda I'm trying now this, after a change in the FilterOptionsPopup: List<LanguageCoordinate> languageCoordinateList = new ArrayList<>();
// iterate FilterOptions languages, and transform to list of LanguageCoordinateRecord
filterOptions.getLanguageCoordinatesList().forEach(l -> {
LanguageCoordinateRecord coordinateRecord = LanguageCoordinateRecord.make(
l.getLanguage().selectedOptions().getFirst().nid(),
IntIds.list.of(l.getPattern().selectedOptions().getFirst().nid()),
IntIds.list.of(l.getDescriptionType().selectedOptions(), EntityFacade::nid),
IntIds.list.of(l.getDialect().selectedOptions(), EntityFacade::nid),
IntIds.list.of(TinkarTerm.SOLOR_OVERLAY_MODULE.nid(), TinkarTerm.SOLOR_MODULE.nid()));
languageCoordinateList.add(coordinateRecord);
});
// create new ViewCoordinateRecord with that list
ViewCoordinateRecord viewCoordinateRecord = ViewCoordinateRecord.make(
observableView.stampCoordinate().toStampCoordinateRecord(),
languageCoordinateList,
observableView.logicCoordinate().toLogicCoordinateRecord(),
observableView.navigationCoordinate().toNavigationCoordinateRecord(),
observableView.editCoordinate().toEditCoordinateRecord());
// and set nodeView with that viewCoordinateRecord
observableView.setValue(viewCoordinateRecord); If I'm doing it right, that seems to work... The following screen recording https://drive.google.com/file/d/1iM1xND46D4RVBnop_qrhEYjfLRjWpj4b/view?usp=sharing shows:
|
Do not merge
This is a draft, it is not working yet, as there is an issue updating the nodeView with two languages (the second one gets lost, but maybe I'm using the wrong API).
Once that is solved, it would need to be tested properly.