Skip to content

Commit

Permalink
Support hebrew language
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Sep 18, 2024
1 parent 384bfb6 commit 4635af4
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/common/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Common.Locale = new(function() {
} else _requireLang();

const _isCurrentRtl = function () {
return currentLang && (/^(ar)$/i.test(currentLang));
return currentLang && (/^(ar|he)$/i.test(currentLang));
};

return {
Expand Down
3 changes: 2 additions & 1 deletion apps/common/main/lib/util/htmlutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (!window.lang) {
window.lang && (window.lang = window.lang.split(/[\-\_]/)[0].toLowerCase());

var isLangRtl = function (lang) {
return lang.lastIndexOf('ar', 0) === 0;
return lang.lastIndexOf('ar', 0) === 0 || lang.lastIndexOf('he', 0) === 0;
}

var ui_rtl = false;
Expand All @@ -68,6 +68,7 @@ if ( ui_rtl && !isIE ) {
if ( isLangRtl(lang) ) {
document.body.classList.add('rtl-font');
}
document.body.setAttribute('applang', lang);

function checkScaling() {
var matches = {
Expand Down
4 changes: 3 additions & 1 deletion apps/common/main/resources/less/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
// -------------------------

.rtl-font {
--font-family-base-custom: system-ui, -apple-system, "Geeza Pro", "Segoe UI", "Traditional Arabic", "Noto Sans";
&[applang=ar] {
--font-family-base-custom: system-ui, -apple-system, "Geeza Pro", "Segoe UI", "Traditional Arabic", "Noto Sans";
}
}

@font-family-sans-serif: Arial, Helvetica, "Helvetica Neue", sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion apps/common/mobile/utils/htmlutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function isLocalStorageAvailable() {
let lang = (/(?:&|^)lang=([^&]+)&?/i).exec(window.location.search.substring(1));
lang = ((lang && lang[1]) || window.Common.Locale.defaultLang).split(/[\-\_]/)[0];
Common.Locale.currentLang = lang;
Common.Locale.isCurrentLangRtl = lang.lastIndexOf('ar', 0) === 0;
Common.Locale.isCurrentLangRtl = lang.lastIndexOf('ar', 0) === 0 || lang.lastIndexOf('he', 0) === 0;
}

{
Expand Down
2 changes: 0 additions & 2 deletions apps/documenteditor/main/app/controller/Viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ define([
var $filemenu = $('.toolbar-fullview-panel');
$filemenu.css('top', Common.UI.LayoutManager.isElementVisible('toolbar') ? _intvars.get('toolbar-height-tabs') : 0);

me.viewport.$el.attr('applang', me.appConfig.lang.split(/[\-_]/)[0]);

if ( !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator) ||
( !Common.localStorage.itemExists("de-compact-toolbar") &&
config.customization && config.customization.compactToolbar )) {
Expand Down
2 changes: 0 additions & 2 deletions apps/pdfeditor/main/app/controller/Viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ define([
var $filemenu = $('.toolbar-fullview-panel');
$filemenu.css('top', Common.UI.LayoutManager.isElementVisible('toolbar') ? _intvars.get('toolbar-height-tabs') : 0);

me.viewport.$el.attr('applang', config.lang.split(/[\-_]/)[0]);

if ( !(config.isEdit || config.isRestrictedEdit) || ( !Common.localStorage.itemExists("pdfe-compact-toolbar") &&
config.customization && config.customization.compactToolbar )) {
var panel = me.viewport.vlayout.getItem('toolbar');
Expand Down
2 changes: 0 additions & 2 deletions apps/presentationeditor/main/app/controller/Viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ define([
var $filemenu = $('.toolbar-fullview-panel');
$filemenu.css('top', Common.UI.LayoutManager.isElementVisible('toolbar') ? _intvars.get('toolbar-height-tabs') : 0);

me.viewport.$el.attr('applang', me.appConfig.lang.split(/[\-_]/)[0]);

if ( !config.isEdit ||
( !Common.localStorage.itemExists("pe-compact-toolbar") &&
config.customization && config.customization.compactToolbar ))
Expand Down
2 changes: 0 additions & 2 deletions apps/spreadsheeteditor/main/app/controller/Viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ define([
var $filemenu = $('.toolbar-fullview-panel');
$filemenu.css('top', Common.UI.LayoutManager.isElementVisible('toolbar') ? _intvars.get('toolbar-height-tabs') : 0);

me.viewport.$el.attr('applang', me.appConfig.lang.split(/[\-_]/)[0]);

if ( !config.isEdit ||
( !Common.localStorage.itemExists("sse-compact-toolbar") &&
config.customization && config.customization.compactToolbar ))
Expand Down

0 comments on commit 4635af4

Please sign in to comment.