blob: c210a3b0132afa0454d828ef30672c34afc8d032 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.vaaclipse.addons.softwarefactory.service;
import java.util.ResourceBundle;
import javax.inject.Inject;
import org.eclipse.e4.core.services.translation.TranslationService;
import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
public class OSBPTranslationService extends TranslationService {
@Inject
private IDSLMetadataService dslMetadataService;
@Override
protected String getResourceString(String key, ResourceBundle resourceBundle) {
String s = key.trim();
if (s.startsWith("%%", 0))
s = s.substring(1);
int ix = s.indexOf(' ');
String rbKey = ix == -1 ? s : s.substring(0, ix);
return translate(rbKey.substring(1), null);
}
@Override
public String translate(String key, String contributorURI) {
return(dslMetadataService.translate(super.locale, key));
}
}