Skip to content
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

Remove dependency to icu4j for html exports #1574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apitools/org.eclipse.pde.api.tools/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ Export-Package: org.eclipse.pde.api.tools.internal;x-friends:="org.eclipse.pde.a
org.eclipse.pde.api.tools.internal.search;x-friends:="org.eclipse.pde.api.tools.tests,org.eclipse.pde.api.tools.ui",
org.eclipse.pde.api.tools.internal.util;x-friends:="org.eclipse.pde.api.tools.tests,org.eclipse.pde.api.tools.ui,org.eclipse.pde.api.tools.generator"
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: com.ibm.icu.util,
org.objectweb.asm;version="[9.5.0,10.0.0)",
Import-Package: org.objectweb.asm;version="[9.5.0,10.0.0)",
org.objectweb.asm.signature;version="[9.5.0,10.0.0)",
org.objectweb.asm.tree;version="[9.5.0,10.0.0)"
Bundle-Activator: org.eclipse.pde.api.tools.internal.provisional.ApiPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
*******************************************************************************/
package org.eclipse.pde.api.tools.internal.search;

import com.ibm.icu.util.ULocale;
import java.util.Locale;
import java.util.Set;

/**
* Contains strings and methods for writing HTML markup
Expand Down Expand Up @@ -77,7 +78,8 @@ public abstract class HTMLConvertor {
/**
* Opening html tag: <code>&lt;html&gt;</code>
*/
public static final String OPEN_HTML = !ULocale.getDefault().isRightToLeft() ? "<html>\n" : "<html dir=\"rtl\">\n";//$NON-NLS-1$ //$NON-NLS-2$
public static final String OPEN_HTML = !isRightToLeft() ? "<html>\n" //$NON-NLS-1$
: "<html dir=\"rtl\">\n";//$NON-NLS-1$
/**
* Closing html tag: <code>&lt;html&gt;</code>
*/
Expand Down Expand Up @@ -163,6 +165,28 @@ public abstract class HTMLConvertor {
*/
public static final String OPEN_H4 = "<h4>"; //$NON-NLS-1$

private static final Set<String> RTL_LANGUAGES = Set.of( //
"ae", /* Avestan */ //$NON-NLS-1$
"ar", /* "العربية", Arabic */ //$NON-NLS-1$
"arc", /* Aramaic */ //$NON-NLS-1$
"bcc", /* "بلوچی مکرانی", Southern Balochi */ //$NON-NLS-1$
"bqi", /* "بختياري", Bakthiari */ //$NON-NLS-1$
"ckb", /* "Soranî / کوردی", Sorani */ //$NON-NLS-1$
"dv", /* Dhivehi */ //$NON-NLS-1$
"fa", /* "فارسی", Persian */ //$NON-NLS-1$
"glk", /* "گیلکی", Gilaki */ //$NON-NLS-1$
"he", /* "עברית", Hebrew */ //$NON-NLS-1$
"ku", /* "Kurdî / كوردی", Kurdish */ //$NON-NLS-1$
"mzn", /* "مازِرونی", Mazanderani */ //$NON-NLS-1$
"nqo", /* N"Ko */ //$NON-NLS-1$
"pnb", /* "پنجابی", Western Punjabi */ //$NON-NLS-1$
"ps", /* "پښتو", Pashto, */ //$NON-NLS-1$
"sd", /* "سنڌي", Sindhi */ //$NON-NLS-1$
"ug", /* "Uyghurche / ئۇيغۇرچە", Uyghur */ //$NON-NLS-1$
"ur", /* "اردو", Urdu */ //$NON-NLS-1$
"yi" /* "ייִדיש", Yiddish */ //$NON-NLS-1$
);

/**
* Opens a new <code>&lt;td&gt;</code> with the given width attribute set
*
Expand All @@ -173,4 +197,8 @@ public static String openTD(int width) {
buffer.append("<td width=\"").append(width).append("%\">"); //$NON-NLS-1$//$NON-NLS-2$
return buffer.toString();
}

private static boolean isRightToLeft() {
return RTL_LANGUAGES.contains(Locale.getDefault().getLanguage());
}
}
Loading