Skip to content

Commit

Permalink
Merge pull request #473 from ONLYOFFICE/component-tooltips
Browse files Browse the repository at this point in the history
Component tooltips
  • Loading branch information
AlexeySafronov authored Jan 21, 2022
2 parents a0a1a1c + df6fdd7 commit d5c6ba0
Show file tree
Hide file tree
Showing 1,554 changed files with 12,531 additions and 12,428 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>

<Configurations>Debug;Release;SORT</Configurations>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Frontend.Translations.Tests", "Frontend.Translations.Tests.csproj", "{FFE0FBAD-0966-4B98-BCFF-7EA864ED8D67}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frontend.Translations.Tests", "Frontend.Translations.Tests.csproj", "{FFE0FBAD-0966-4B98-BCFF-7EA864ED8D67}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
SORT|Any CPU = SORT|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FFE0FBAD-0966-4B98-BCFF-7EA864ED8D67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFE0FBAD-0966-4B98-BCFF-7EA864ED8D67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFE0FBAD-0966-4B98-BCFF-7EA864ED8D67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFE0FBAD-0966-4B98-BCFF-7EA864ED8D67}.Release|Any CPU.Build.0 = Release|Any CPU
{FFE0FBAD-0966-4B98-BCFF-7EA864ED8D67}.SORT|Any CPU.ActiveCfg = SORT|Any CPU
{FFE0FBAD-0966-4B98-BCFF-7EA864ED8D67}.SORT|Any CPU.Build.0 = SORT|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
91 changes: 52 additions & 39 deletions common/Tests/Frontend.Translations.Tests/LocalesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
using System.Text;
using System.Text.RegularExpressions;

using Frontend.Translations.Tests.Models;

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

Expand Down Expand Up @@ -52,7 +50,7 @@ public void Setup()

var moduleWorkspaces = ((JArray)jsonPackage["workspaces"])
.Select(p => ((string)p).Replace("/", "\\"))
.Where(w => !w.Contains("asc-web-components"))
//.Where(w => !w.Contains("asc-web-components"))
.ToList();

Workspaces = new List<string>();
Expand Down Expand Up @@ -82,6 +80,10 @@ where filePath.Contains("public\\locales\\")
new JsonEncodingError(path, result.Detected));
}

#if SORT

JObject jsonSorted;
#endif
using (var md5 = MD5.Create())
{
using (var stream = File.OpenRead(path))
Expand All @@ -100,20 +102,19 @@ where filePath.Contains("public\\locales\\")
.ToList(), md5hash);

TranslationFiles.Add(translationFile);
}

#if SORT
var orderedList = jsonTranslation.Properties().OrderBy(t => t.Name);
jsonSorted = new JObject(orderedList);
#endif
}
}
#if SORT
// Re-write by order
var sortedJsonString = JsonConvert.SerializeObject(jsonSorted, Formatting.Indented);
File.WriteAllText(path, sortedJsonString, Encoding.UTF8);
#endif
}

/* Re-write by order */

//var orderedList = jsonTranslation.Properties().OrderBy(t => t.Name);

//var result = new JObject(orderedList);

//var sortedJsonString = JsonConvert.SerializeObject(result, Formatting.Indented);

//File.WriteAllText(path, sortedJsonString);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -153,15 +154,18 @@ from file in Directory.EnumerateFiles(clientDir, "*.jsx", SearchOption.AllDirect
{
var jsFileText = File.ReadAllText(path);

var toastMatches = notTranslatedToastsRegex.Matches(jsFileText).ToList();

if (toastMatches.Any())
if (!path.Contains("asc-web-components"))
{
foreach (var toastMatch in toastMatches)
var toastMatches = notTranslatedToastsRegex.Matches(jsFileText).ToList();

if (toastMatches.Any())
{
var found = toastMatch.Value;
if (!string.IsNullOrEmpty(found) && !NotTranslatedToasts.Exists(t => t.Value == found))
NotTranslatedToasts.Add(new KeyValuePair<string, string>(path, found));
foreach (var toastMatch in toastMatches)
{
var found = toastMatch.Value;
if (!string.IsNullOrEmpty(found) && !NotTranslatedToasts.Exists(t => t.Value == found))
NotTranslatedToasts.Add(new KeyValuePair<string, string>(path, found));
}
}
}

Expand Down Expand Up @@ -204,7 +208,6 @@ from file in Directory.EnumerateFiles(clientDir, "*.jsx", SearchOption.AllDirect
{
ModulePath = g.Key,
Languages = g.ToList().Select(t => t.Language).ToList()
.ToList()
})
.ToList();

Expand All @@ -223,17 +226,17 @@ from file in Directory.EnumerateFiles(clientDir, "*.jsx", SearchOption.AllDirect
})
.ToList();

foreach (var ws in moduleWorkspaces)
foreach (var wsPath in moduleWorkspaces)
{
var t = moduleTranslations.FirstOrDefault(t => t.ModulePath == ws);
var j = moduleJsTranslatedFiles.FirstOrDefault(t => t.ModulePath == ws);
var t = moduleTranslations.FirstOrDefault(t => t.ModulePath == wsPath);
var j = moduleJsTranslatedFiles.FirstOrDefault(t => t.ModulePath == wsPath);

if (j == null && t == null)
continue;

ModuleFolders.Add(new ModuleFolder
{
Path = ws,
Path = wsPath,
AvailableLanguages = t?.Languages,
AppliedJsTranslationKeys = j?.TranslationKeys
});
Expand Down Expand Up @@ -327,7 +330,7 @@ public void SpellCheckTest()
}

//string json = JsonConvert.SerializeObject(list, Formatting.Indented);
//File.WriteAllText("../../../spellcheck-excludes.json", json);
//File.WriteAllText("../../../spellcheck-excludes.json", json, Encoding.UTF8);

Assert.AreEqual(0, errorsCount, message);
}
Expand All @@ -337,8 +340,12 @@ public void SpellCheckTest()
public void DublicatesFilesByMD5HashTest()
{
var skipHashes = new List<string>() {
"bcba174a8dadc0ff97f37f9a2d816d88",
"2a506ed97d0fbd0858192b755ae122d0",
"e6d664afaace71b3a22abb09fc124543",
"5a1d4d36141c7a8ca53f2540f3fd5940",
"6d3334459f062ba0f39de6a38225c564",
"b8e7630201c96d26c94d348447328276",
"3ad0e57ce636af715af3f629e364f1ed",
"dfb129715a0122a29afe233226c648d9",
"ec73989085d4e1b984c1c9dca10524da"
};

Expand Down Expand Up @@ -446,7 +453,7 @@ public static void SaveNotFoundLanguage(string existJsonPath, string notExistJso
if (!Directory.Exists(fullPathOnly))
Directory.CreateDirectory(fullPathOnly);

File.WriteAllText(notExistJsonPath, sortedJsonString);
File.WriteAllText(notExistJsonPath, sortedJsonString, Encoding.UTF8);
}

[Test]
Expand Down Expand Up @@ -523,7 +530,7 @@ public static void SaveNotFoundKeys(string pathToJson, List<string> newKeys)

var sortedJsonString = JsonConvert.SerializeObject(result, Formatting.Indented);

File.WriteAllText(pathToJson, sortedJsonString);
File.WriteAllText(pathToJson, sortedJsonString, Encoding.UTF8);
}

[Test]
Expand Down Expand Up @@ -624,15 +631,17 @@ public void UselessModuleTranslationKeysTest()
{
var notFoundi18nKeys = new List<KeyValuePair<string, List<string>>>();

var message = $"Some i18n-keys are not found in js: \r\nKeys: \r\n\r\n";
var message = $"Some i18n-keys are not found in Module or Common translations: \r\nKeys: \r\n\r\n";

var index = 0;

for (int i = 0; i < ModuleFolders.Count; i++)
{
var module = ModuleFolders[i];

if (module.AppliedJsTranslationKeys == null && module.AvailableLanguages != null)
{
message += $"{i}. 'ANY LANGUAGES' '{module.Path}' NOT USES";
message += $"{++index}. 'ANY LANGUAGES' '{module.Path}' NOT USES";

var list = module.AvailableLanguages
.SelectMany(l => l.Translations.Select(t => t.Key).ToList())
Expand All @@ -645,13 +654,17 @@ public void UselessModuleTranslationKeysTest()

var notCommonKeys = module.AppliedJsTranslationKeys
.Where(k => !k.StartsWith("Common:"))
.OrderBy(t => t)
.ToList();

var onlyCommonKeys = module.AppliedJsTranslationKeys
.Except(notCommonKeys)
.Select(k => k.Replace("Common:", ""))
.OrderBy(t => t)
.ToList();

notCommonKeys = notCommonKeys.Select(k => k.Substring(k.IndexOf(":") + 1)).ToList();

if (onlyCommonKeys.Any())
{
foreach (var lng in CommonTranslations)
Expand All @@ -663,7 +676,7 @@ public void UselessModuleTranslationKeysTest()
if (!list.Any())
continue;

message += $"{i}. '{lng.Language}' '{module.Path}' \r\n {string.Join("\r\n", list)} \r\n";
message += $"{++index}. '{lng.Language}' '{module.Path}' \r\n {string.Join("\r\n", list)} \r\n";

notFoundi18nKeys.Add(new KeyValuePair<string, List<string>>(lng.Language, list));
}
Expand All @@ -673,7 +686,7 @@ public void UselessModuleTranslationKeysTest()
{
if (notCommonKeys.Any())
{
message += $"{i}. 'ANY LANGUAGES' '{module.Path}' \r\n {string.Join("\r\n", notCommonKeys)} \r\n";
message += $"{++index}. 'ANY LANGUAGES' '{module.Path}' \r\n {string.Join("\r\n", notCommonKeys)} \r\n";

notFoundi18nKeys.Add(new KeyValuePair<string, List<string>>("ANY LANGUAGES", notCommonKeys));
}
Expand All @@ -685,13 +698,13 @@ public void UselessModuleTranslationKeysTest()
{
var list = lng.Translations
.Select(t => t.Key)
.Except(notCommonKeys.Select(k => k.Substring(k.IndexOf(":") + 1)))
.Except(notCommonKeys)
.ToList();

if (!list.Any())
continue;

message += $"{i}. '{lng.Language}' '{module.Path}' \r\n {string.Join("\r\n", list)} \r\n";
message += $"{++index}. '{lng.Language}' '{module.Path}' \r\n {string.Join("\r\n", list)} \r\n";

notFoundi18nKeys.Add(new KeyValuePair<string, List<string>>(lng.Language, list));
}
Expand Down Expand Up @@ -761,7 +774,7 @@ public static void UpdateKeys(string pathToJson, List<TranslationItem> newKeys)

var sortedJsonString = JsonConvert.SerializeObject(result, Formatting.Indented);

File.WriteAllText(pathToJson, sortedJsonString);
File.WriteAllText(pathToJson, sortedJsonString, Encoding.UTF8);
}

public static void RemoveEmptyKeys(string pathToJson, List<string> emptyKeys)
Expand All @@ -777,7 +790,7 @@ public static void RemoveEmptyKeys(string pathToJson, List<string> emptyKeys)

var sortedJsonString = JsonConvert.SerializeObject(result, Formatting.Indented);

File.WriteAllText(pathToJson, sortedJsonString);
File.WriteAllText(pathToJson, sortedJsonString, Encoding.UTF8);
}

public string GetWorkspace(string path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class FilterButton extends React.PureComponent {
id={id}
isDisabled={isDisabled}
size={iconSize}
title="Actions"
columnCount={columnCount}
displayType={asideView ? "aside" : "auto"}
asideHeader={asideHeader}
Expand Down
1 change: 1 addition & 0 deletions packages/asc-web-components/checkbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Checkbox extends React.Component {
isDisabled={isDisabled}
isIndeterminate={isIndeterminate}
className={className}
title={title}
>
<HiddenInput
type="checkbox"
Expand Down
2 changes: 2 additions & 0 deletions packages/asc-web-components/context-menu-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class ContextMenuButton extends React.Component {
isFill, // eslint-disable-line react/prop-types
asideHeader, // eslint-disable-line react/prop-types
isNew,
title,
} = this.props;

const { isOpen, displayType, offsetX, offsetY } = this.state;
Expand Down Expand Up @@ -190,6 +191,7 @@ class ContextMenuButton extends React.Component {
onMouseLeave={onMouseLeave}
onMouseOver={onMouseOver}
onMouseOut={onMouseOut}
title={title}
/>
{displayType === "dropdown" ? (
<DropDown
Expand Down
2 changes: 2 additions & 0 deletions packages/asc-web-components/icon-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@ class IconButton extends React.PureComponent {
id,
style,
dataTip,
title,
...rest
} = this.props;

return (
<StyledOuter
className={className}
size={size}
title={title}
isDisabled={isDisabled}
onMouseEnter={this.onMouseEnter}
onMouseLeave={this.onMouseLeave}
Expand Down
3 changes: 2 additions & 1 deletion packages/asc-web-components/table-container/GroupMenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ const StyledButton = styled(Button)`
`;

const GroupMenuItem = ({ item }) => {
const { label, disabled, onClick, iconUrl } = item;
const { label, disabled, onClick, iconUrl, title } = item;
return (
<StyledButton
label={label}
title={title || label}
isDisabled={disabled}
onClick={onClick}
icon={<ReactSVG src={iconUrl} className="combo-button_selected-icon" />}
Expand Down
5 changes: 5 additions & 0 deletions packages/asc-web-components/table-container/TableGroupMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Checkbox from "../checkbox";
import { StyledTableGroupMenu, StyledScrollbar } from "./StyledTableContainer";
import ComboBox from "../combobox";
import GroupMenuItem from "./GroupMenuItem";
import { useTranslation } from "react-i18next";

const TableGroupMenu = (props) => {
const {
Expand All @@ -20,6 +21,8 @@ const TableGroupMenu = (props) => {
onChange && onChange(e.target && e.target.checked);
};

const { t } = useTranslation("Common");

return (
<>
<StyledTableGroupMenu
Expand All @@ -32,6 +35,7 @@ const TableGroupMenu = (props) => {
onChange={onCheckboxChange}
isChecked={isChecked}
isIndeterminate={isIndeterminate}
title={t("Common:MainHeaderSelectAll")}
/>
<ComboBox
comboIcon="/static/images/triangle.navigation.down.react.svg"
Expand All @@ -42,6 +46,7 @@ const TableGroupMenu = (props) => {
selectedOption={{}}
manualY="42px"
manualX="-32px"
title={t("Common:TitleSelectFile")}
/>
<div className="table-container_group-menu-separator" />
<StyledScrollbar>
Expand Down
3 changes: 3 additions & 0 deletions packages/asc-web-components/table-container/TableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const TableRow = (props) => {
className,
style,
selectionProp,
isFolder,
title,
...rest
} = props;

Expand Down Expand Up @@ -65,6 +67,7 @@ const TableRow = (props) => {
directionX="right"
isNew={true}
onClick={onContextMenu}
title={title}
/>
) : (
<div className="expandButton"> </div>
Expand Down
Loading

0 comments on commit d5c6ba0

Please sign in to comment.