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

Plop (testing fix for python 3.11) #3190

Closed
wants to merge 105 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
8064481
fix: add LocalizerKeys type to getMessage and remove updateLocale fun…
Aerilym Feb 15, 2024
28d055c
fix: add withAcceleratorPrefix function to remove accelerator prefixe…
Aerilym Feb 19, 2024
0a9535e
Update Crowdin configuration file
mpretty-cyro Feb 29, 2024
a69e00a
Update crowdin.yml
mpretty-cyro Feb 29, 2024
4876a81
Update Crowdin configuration file
mpretty-cyro Feb 29, 2024
7c76827
Update crowdin.yml
mpretty-cyro Mar 1, 2024
73a90ef
Merge branch 'oxen-io:unstable' into standardised_strings
Aerilym Mar 8, 2024
a508dfe
Merge branch 'oxen-io:unstable' into standardised_strings
Aerilym Mar 12, 2024
19442d6
chore: disappearing messages string changes
Aerilym Mar 12, 2024
f7b1a26
Merge branch 'standardised_strings' of github.com:Aerilym/session-des…
Aerilym Mar 12, 2024
43a5d3e
feat: strict typing for i18n function and component
Aerilym Mar 27, 2024
842a879
feat: add i18n component for rendering html from a localized string
Aerilym Mar 27, 2024
9028307
feat: rework i18n getMessages to use named dynamic vairiables and str…
Aerilym Mar 27, 2024
665d8d6
feat: add as prop to I18n component for rendering a specific tag
Aerilym Mar 27, 2024
7ba74f8
fix: add React.ElementType type to SessionHTMLRenderer and rename tag…
Aerilym Mar 27, 2024
64b202a
feat: remove strings no longer supported by the localization project
Aerilym Mar 28, 2024
7fbb5ef
feat: replace and add changed and new localized strings
Aerilym Mar 28, 2024
2fa5d3e
feat: reword SubtitleNotification to use changed localized strings an…
Aerilym Mar 28, 2024
f15df79
feat: update CallNotificaiton strings and enforce type safety
Aerilym Mar 28, 2024
325fb5f
feat: change localized strings in ReactionPopup and refactor logic fo…
Aerilym Mar 28, 2024
b7542a4
feat: create strict typing for localization
Aerilym Mar 28, 2024
285b81d
feat: add concurrently and nodemon and locale building script
Aerilym Mar 28, 2024
f935485
fix: add ignores for the generated locale type file
Aerilym Mar 28, 2024
d557b8c
fix: rename SessionHtmlRenderer as prop to tag to work with styled co…
Aerilym Mar 28, 2024
bfee33d
feat: create localized python strings scripts and utility functions
Aerilym Mar 28, 2024
cd7d8c6
fix: add optional chainging to i18n log in case the window object is …
Aerilym Mar 28, 2024
259edee
feat: add br tag support to the i18n component for triggering html re…
Aerilym Mar 28, 2024
b4d24ef
fix: spelling mistake in getMessage comment
Aerilym Mar 28, 2024
b062521
feat: update strings usages and library
Aerilym Jul 26, 2024
1391aac
feat: add custom tags for i18n
Aerilym Aug 6, 2024
67144a6
Merge branch 'unstable' into standardised_strings_merge
Aerilym Aug 6, 2024
f8c9912
Merge remote-tracking branch 'upstream/unstable' into standardised_st…
Bilb Aug 13, 2024
b85ab1c
fix: update with latest changes from crowdin
Bilb Aug 14, 2024
93d2602
feat: create custom tag parser and tag renderer
Aerilym Aug 14, 2024
3c3b790
fix: use I18n component in subtleNotifications
Aerilym Aug 14, 2024
637f9e7
feat: refactor reaction popup to use i18n component
Aerilym Aug 14, 2024
58ca6b8
fix: getMessage default substitutions
Aerilym Aug 14, 2024
b2f70aa
fix: more i18n changes
Bilb Aug 14, 2024
41fb527
Merge branch 'standardised_strings' of github.com:Aerilym/session-des…
Bilb Aug 15, 2024
5348bd1
fix: use date-fns for abbreviated expire timer
Bilb Aug 15, 2024
bbea682
fix: group updates localization shares logic with component
Bilb Aug 15, 2024
9a5851e
feat: create html stripper for i18n strings and add plurals support
Aerilym Aug 19, 2024
ace50c7
fix: plurals and tag strips in app
Aerilym Aug 19, 2024
7a0e38c
fix: toast strings are stripped as we don't render html there
Bilb Aug 19, 2024
1e782fe
fix: plurals not triggering every second time
Aerilym Aug 19, 2024
f47d901
fix: remove unused type
Aerilym Aug 19, 2024
a7515cc
fix: plurals arg type
Aerilym Aug 19, 2024
90922d4
chore: update en dictionary
Aerilym Aug 19, 2024
f49dba2
fix: toast stripped function fetch cannot run on import
Bilb Aug 19, 2024
dcb8299
chore: update localization regex script to support getString and i18n…
Aerilym Aug 19, 2024
5736147
chore: fix typo in README.md
Aerilym Aug 19, 2024
1a41c92
feat: move openUrl modal to its own as maxHeight is linked to url len
Bilb Aug 19, 2024
e94b150
fix: message sent status not clickable unless if error
Bilb Aug 19, 2024
754753f
fix: make attachment "save" hidden until downloaded
Bilb Aug 19, 2024
856a32f
chore: cleanup
Bilb Aug 20, 2024
84319d2
Merge remote-tracking branch 'upstream/unstable' into standardised_st…
Bilb Aug 20, 2024
3167f91
[Automated] Update translations from Crowdin
mpretty-cyro Aug 21, 2024
cd3a0cb
feat: remove html renderer from all places and use I18n with strict t…
Aerilym Aug 21, 2024
6ea683f
feat: locale as args for modals and localized formatted html strings
Aerilym Aug 21, 2024
e57dcdf
feat: only sanitize html tags from inputs if they are being used in a…
Aerilym Aug 21, 2024
8fb8f44
feat: window i18n types and docs with safe setup and fallbacks
Aerilym Aug 21, 2024
7d16166
fix: disable password buttons/enter when no pw given
Bilb Aug 21, 2024
4539a88
fix: don't trim entered passwords
Bilb Aug 21, 2024
87c1ed6
chore: lint
Bilb Aug 21, 2024
66b6425
feat: add block/unblock modal
Bilb Aug 22, 2024
b8a04fd
Merge remote-tracking branch 'morgan/feature/update-translations' int…
Bilb Aug 22, 2024
975734d
feat: fallback to en is a string is not found on the locale
Aerilym Aug 22, 2024
3b5837b
fix: add json import to generateLocalizedStringsAnalysis.py
Aerilym Aug 22, 2024
91abca1
feat: add inEnglish method to i18n
Aerilym Aug 22, 2024
4066391
chore: write initial i18n unit tests
Aerilym Aug 22, 2024
53e7c69
chore: fix i18n test names
Aerilym Aug 23, 2024
4af1efa
feat: remove moment and replace with date-fns
Bilb Aug 23, 2024
a90496b
fix: break down i18n file and remove translations from redux
Bilb Aug 23, 2024
8cbb361
test: fix package.json unit test
Bilb Aug 23, 2024
d75c9b4
fix: strip of tags notification/lastmessage
Bilb Aug 23, 2024
3ac0afd
fix: typings for getMessage i18n
Bilb Aug 23, 2024
31ce336
Merge remote-tracking branch 'upstream/unstable' into standardised_st…
Bilb Aug 23, 2024
997d511
chore: fetch latest strings and fix errors
Bilb Aug 23, 2024
d5e7e03
chore: remove loadDictionary
Bilb Aug 23, 2024
7dd4986
fix: relative strings localization, latest changes from crowdin
Bilb Aug 26, 2024
ba53e58
fix: use hidemenu desc & download file with filetype
Bilb Aug 26, 2024
5c69732
chore: cleaned package.json & string TODOs
Bilb Aug 26, 2024
197c78e
fix: do not shrink timestamp in conversation list item
Bilb Aug 26, 2024
ebf557a
chore: latest crowdin fetch & fixes
Bilb Aug 26, 2024
7303202
chore: update python strings regex
Aerilym Aug 27, 2024
6843aa3
feat: add i18n setup to all preloaders
Aerilym Aug 27, 2024
8b5ca70
fix: update strings feature flag to be ignored by node when no window…
Aerilym Aug 27, 2024
8779a40
feat: add localization to the node side of the app
Aerilym Aug 27, 2024
ed7de69
fix: quitmodal warning was empty
Bilb Aug 28, 2024
ff80c3e
fix: title for change group name & members dialog
Bilb Aug 28, 2024
001c9bd
chore: fix strings
Aerilym Aug 27, 2024
4b39785
chore: cleanup strings usages
Aerilym Aug 28, 2024
7b1e5a1
chore: create find unused strings scripts
Aerilym Aug 28, 2024
e4503e9
fix: display 0 seconds timer as off
Bilb Aug 28, 2024
358ce91
Merge branch 'standardised_strings' of github.com:oxen-io/session-des…
Bilb Aug 28, 2024
77b9650
chore: replaced "pin/unpin conversation" with "pin/unpin"
Bilb Aug 28, 2024
2a02202
fix: refactor disappearing messages control messages
Aerilym Aug 28, 2024
eac653e
chore: remove unused import
Aerilym Aug 28, 2024
8c8e3fc
Merge remote-tracking branch 'upstream/unstable' into standardised_st…
Bilb Aug 28, 2024
1e17c81
chore: latest crowdin fetch
Bilb Aug 28, 2024
03518d7
fix: latest crowdin fetches
Bilb Aug 28, 2024
ba8ac01
Merge branch 'standardised_strings' of github.com:oxen-io/session-des…
Bilb Aug 28, 2024
b1609bf
chore: remove unused locale strings
Bilb Aug 29, 2024
4eca406
chore: bump to 1.13.3 & do not fail on locale issues
Bilb Aug 29, 2024
ab4da01
chore: fix generateLocales script for python < 3.11
Bilb Aug 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ stylesheets/dist/
compiled.d.ts
.eslintrc.js
playwright.config.js

ts/localization/locales.ts
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ stylesheets/dist/

*.LICENSE.txt
ts/webworker/workers/node/**/*.node
ts/localization/locales.ts

.yarn/**/*.mjs
.yarn/**/*.cjs
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.15.0
18.15.0
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ release/**
.nyc_output/
coverage/
stylesheets/dist/**

ts/localization/locales.ts

# _locales files are generated by crowdin now.
_locales/
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,24 @@ Setup instructions for Windows using Chocolatey:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```


### Linux

1. Install build tools `apt install build-essential cmake` (this installs make, g++, gcc)
2. Depending on your distro, you might need to install `hunspell` and `hunspell-<lan>` (e.g. `hunspell-en-au`)

In Ubuntu, you may also need to install

```
sudo apt install cmake
npm install cmake-js
```

In Fedora, you may also need to install

```
sudo dnf install make automake gcc gcc-c++ kernel-devel
```


### All platforms

Now, run these commands in your preferred terminal in a good directory for development:
Expand Down Expand Up @@ -237,7 +237,7 @@ So you wanna make a pull request? Please observe the following guidelines.
this script generates updated TypeScript type definitions to ensure you aren't
using a localisation key which doesn't exist.
- Please do not submit pull requests for pure translation fixes. Anyone can update
the translations at [Crowdin](https://crowdin.com/project/session-desktop).
the translations at [Crowdin](https://crowdin.com/project/session-crossplatform-strings).
- [Rebase](https://nathanleclaire.com/blog/2014/09/14/dont-be-scared-of-git-rebase/) your
changes on the latest `clearnet` branch, resolving any conflicts.
This ensures that your changes will merge cleanly when you open your PR.
Expand Down
422 changes: 422 additions & 0 deletions _locales/af/messages.json

Large diffs are not rendered by default.

932 changes: 419 additions & 513 deletions _locales/ar/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/az/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/bal/messages.json

Large diffs are not rendered by default.

935 changes: 421 additions & 514 deletions _locales/be/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/bg/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/bn/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/ca/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/cs/messages.json

Large diffs are not rendered by default.

420 changes: 420 additions & 0 deletions _locales/cy/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/da/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/de/messages.json

Large diffs are not rendered by default.

931 changes: 418 additions & 513 deletions _locales/el/messages.json

Large diffs are not rendered by default.

1,061 changes: 453 additions & 608 deletions _locales/en/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/eo/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/es-419/messages.json

Large diffs are not rendered by default.

933 changes: 420 additions & 513 deletions _locales/es/messages.json

Large diffs are not rendered by default.

514 changes: 0 additions & 514 deletions _locales/es_419/messages.json

This file was deleted.

933 changes: 420 additions & 513 deletions _locales/et/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/eu/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/fa/messages.json

Large diffs are not rendered by default.

930 changes: 417 additions & 513 deletions _locales/fi/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/fil/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/fr/messages.json

Large diffs are not rendered by default.

421 changes: 421 additions & 0 deletions _locales/gl/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/ha/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/he/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/hi/messages.json

Large diffs are not rendered by default.

931 changes: 418 additions & 513 deletions _locales/hr/messages.json

Large diffs are not rendered by default.

933 changes: 420 additions & 513 deletions _locales/hu/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/hy-AM/messages.json

Large diffs are not rendered by default.

933 changes: 420 additions & 513 deletions _locales/id/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/it/messages.json

Large diffs are not rendered by default.

929 changes: 416 additions & 513 deletions _locales/ja/messages.json

Large diffs are not rendered by default.

935 changes: 421 additions & 514 deletions _locales/ka/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/km/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/kmr/messages.json

Large diffs are not rendered by default.

935 changes: 421 additions & 514 deletions _locales/kn/messages.json

Large diffs are not rendered by default.

931 changes: 418 additions & 513 deletions _locales/ko/messages.json

Large diffs are not rendered by default.

421 changes: 421 additions & 0 deletions _locales/ku/messages.json

Large diffs are not rendered by default.

421 changes: 421 additions & 0 deletions _locales/lg/messages.json

Large diffs are not rendered by default.

152 changes: 152 additions & 0 deletions _locales/lo/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/lt/messages.json

Large diffs are not rendered by default.

935 changes: 421 additions & 514 deletions _locales/lv/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/mk/messages.json

Large diffs are not rendered by default.

420 changes: 420 additions & 0 deletions _locales/mn/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/ms/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/my/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/nb/messages.json

Large diffs are not rendered by default.

363 changes: 363 additions & 0 deletions _locales/ne/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/nl/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/nn/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/no/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/ny/messages.json

Large diffs are not rendered by default.

919 changes: 405 additions & 514 deletions _locales/pa/messages.json

Large diffs are not rendered by default.

932 changes: 419 additions & 513 deletions _locales/pl/messages.json

Large diffs are not rendered by default.

418 changes: 418 additions & 0 deletions _locales/ps/messages.json

Large diffs are not rendered by default.

421 changes: 421 additions & 0 deletions _locales/pt-BR/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/pt-PT/messages.json

Large diffs are not rendered by default.

514 changes: 0 additions & 514 deletions _locales/pt_BR/messages.json

This file was deleted.

514 changes: 0 additions & 514 deletions _locales/pt_PT/messages.json

This file was deleted.

933 changes: 420 additions & 513 deletions _locales/ro/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/ru/messages.json

Large diffs are not rendered by default.

421 changes: 421 additions & 0 deletions _locales/sh/messages.json

Large diffs are not rendered by default.

931 changes: 418 additions & 513 deletions _locales/si/messages.json

Large diffs are not rendered by default.

933 changes: 420 additions & 513 deletions _locales/sk/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/sl/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/sq/messages.json

Large diffs are not rendered by default.

933 changes: 420 additions & 513 deletions _locales/sr/messages.json

Large diffs are not rendered by default.

932 changes: 419 additions & 513 deletions _locales/sv/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/sw/messages.json

Large diffs are not rendered by default.

931 changes: 417 additions & 514 deletions _locales/ta/messages.json

Large diffs are not rendered by default.

420 changes: 420 additions & 0 deletions _locales/te/messages.json

Large diffs are not rendered by default.

931 changes: 418 additions & 513 deletions _locales/th/messages.json

Large diffs are not rendered by default.

935 changes: 421 additions & 514 deletions _locales/tl/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/tr/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/uk/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/ur/messages.json

Large diffs are not rendered by default.

929 changes: 416 additions & 513 deletions _locales/uz/messages.json

Large diffs are not rendered by default.

934 changes: 421 additions & 513 deletions _locales/vi/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/xh/messages.json

Large diffs are not rendered by default.

422 changes: 422 additions & 0 deletions _locales/zh-CN/messages.json

Large diffs are not rendered by default.

420 changes: 420 additions & 0 deletions _locales/zh-TW/messages.json

Large diffs are not rendered by default.

514 changes: 0 additions & 514 deletions _locales/zh_CN/messages.json

This file was deleted.

514 changes: 0 additions & 514 deletions _locales/zh_TW/messages.json

This file was deleted.

10 changes: 6 additions & 4 deletions about_preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
const { ipcRenderer } = require('electron');
const url = require('url');
const os = require('os');
const i18n = require('./ts/util/i18n');
const { setupI18n } = require('./ts/util/i18n/i18n');

const config = url.parse(window.location.toString(), true).query;
const { locale } = config;
const localeMessages = ipcRenderer.sendSync('locale-data');
const { dictionary, locale } = ipcRenderer.sendSync('locale-data');

window.theme = config.theme;
window.i18n = i18n.setupi18n(locale, localeMessages);
window.i18n = setupI18n({
locale,
translationDictionary: dictionary,
});

window.getOSRelease = () =>
`${os.type()} ${os.release()}, Node.js ${config.node_version} ${os.platform()} ${os.arch()}`;
Expand Down
3 changes: 3 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commit_message: '[CI SKIP]'
bundles:
- 12
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "session-desktop",
"productName": "Session",
"description": "Private messaging from your desktop",
"version": "1.13.1",
"version": "1.13.3",
"license": "GPL-3.0",
"author": {
"name": "Oxen Labs",
Expand All @@ -18,7 +18,6 @@
"getobject": "^1.0.0",
"ansi-regex": "^4.1.1",
"async": "^2.6.4",
"moment": "^2.29.4",
"lodash": "^4.17.20",
"ini": "^1.3.6",
"ejs": "^3.1.7",
Expand All @@ -37,10 +36,13 @@
"start-prod": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron .",
"start-prod:pretty": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron . | npx bunyan",
"start-dev": "cross-env NODE_ENV=development NODE_APP_INSTANCE=devprod$MULTI electron .",
"build-everything": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && python3 ./tools/localization/generateLocalizedStringsAnalysis.py --print-not-found --delete-unused-keys && yarn build:locales-soft && tsc && yarn build:workers",
"build-everything:soft": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && tsc && yarn build:workers",
"build-everything:watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && yarn build:workers && yarn tsc -w",
"start-dev:pretty": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron . | npx bunyan",
"build-everything": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && tsc && yarn build:workers",
"build-everything:watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:workers && tsc -w",
"build:workers": "yarn worker:utils && yarn worker:libsession",
"build:locales": "python3 ./tools/localization/generateLocales.py --generate-types --print-problems --error-on-problems --error-old-dynamic-variables",
"build:locales-soft": "python3 ./tools/localization/generateLocales.py --generate-types --print-problems",
"watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn build-everything:watch",
"protobuf": "pbjs --target static-module --wrap commonjs --out ts/protobuf/compiled.js protos/*.proto && pbts --out ts/protobuf/compiled.d.ts ts/protobuf/compiled.js --force-long",
"sass": "rimraf 'stylesheets/dist/' && webpack --config=./sass.config.js",
Expand Down Expand Up @@ -88,7 +90,7 @@
"classnames": "2.2.5",
"config": "1.28.1",
"curve25519-js": "https://github.com/oxen-io/curve25519-js",
"date-fns": "^3.3.1",
"date-fns": "^3.6.0",
"dompurify": "^2.0.7",
"electron-localshortcut": "^3.2.1",
"electron-updater": "^4.2.2",
Expand All @@ -106,7 +108,6 @@
"long": "^4.0.0",
"maxmind": "^4.3.18",
"mic-recorder-to-mp3": "^2.2.2",
"moment": "^2.29.4",
"node-fetch": "^2.6.7",
"os-locale": "5.0.0",
"p-retry": "^4.2.0",
Expand Down Expand Up @@ -181,6 +182,7 @@
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"chai-bytes": "^0.1.2",
"concurrently": "^8.2.2",
"cross-env": "^6.0.3",
"css-loader": "^6.7.2",
"dmg-builder": "23.6.0",
Expand Down Expand Up @@ -212,7 +214,7 @@
"sass-loader": "^13.2.2",
"sinon": "9.0.2",
"ts-loader": "^9.4.2",
"typescript": "^5.1.6",
"typescript": "^5.5.4",
"webpack": "^5.76.3",
"webpack-cli": "^5.1.4",
"yarn-deduplicate": "^6.0.2"
Expand Down
10 changes: 6 additions & 4 deletions password_preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@

const { ipcRenderer } = require('electron');
const url = require('url');
const i18n = require('./ts/util/i18n');
const { setupI18n } = require('./ts/util/i18n/i18n');

const config = url.parse(window.location.toString(), true).query;
const { locale } = config;
const localeMessages = ipcRenderer.sendSync('locale-data');
const { dictionary, locale } = ipcRenderer.sendSync('locale-data');

// If the app is locked we can't access the database to check the theme.
window.theme = 'classic-dark';
window.primaryColor = 'green';
window.i18n = i18n.setupi18n(locale, localeMessages);
window.i18n = setupI18n({
locale,
translationDictionary: dictionary,
});

window.getEnvironment = () => config.environment;
window.getVersion = () => config.version;
Expand Down
18 changes: 9 additions & 9 deletions preload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint:disable: no-require-imports no-var-requires
const { clipboard, ipcRenderer, webFrame } = require('electron/main');
const { clipboard, ipcRenderer: ipc, webFrame } = require('electron/main');
const { Storage } = require('./ts/util/storage');

const { isTestNet, isTestIntegration } = require('./ts/shared/env_vars');
Expand All @@ -9,9 +9,15 @@ const url = require('url');

const _ = require('lodash');

const { setupI18n } = require('./ts/util/i18n/i18n');

const { dictionary, locale } = ipc.sendSync('locale-data');

const config = url.parse(window.location.toString(), true).query;
const configAny = config;

window.i18n = setupI18n({ locale, translationDictionary: dictionary });

let title = config.name;
if (config.environment !== 'production') {
title += ` - ${config.environment}`;
Expand All @@ -29,12 +35,13 @@ window.getCommitHash = () => configAny.commitHash;
window.getNodeVersion = () => configAny.node_version;
window.getOSRelease = () =>
`${os.type()} ${os.release()}, Node.js ${config.node_version} ${os.platform()} ${os.arch()}`;
window.saveLog = additionalText => ipcRenderer.send('save-debug-log', additionalText);
window.saveLog = additionalText => ipc.send('save-debug-log', additionalText);

window.sessionFeatureFlags = {
useOnionRequests: true,
useTestNet: isTestNet() || isTestIntegration(),
useClosedGroupV3: false,
replaceLocalizedStringsWithKeys: false,
debug: {
debugLogging: !_.isEmpty(process.env.SESSION_DEBUG),
debugLibsessionDumps: !_.isEmpty(process.env.SESSION_DEBUG_LIBSESSION_DUMPS),
Expand All @@ -51,9 +58,6 @@ window.versionInfo = {
appInstance: window.getAppInstance(),
};

const ipc = ipcRenderer;
const localeMessages = ipc.sendSync('locale-data');

window.updateZoomFactor = () => {
const zoomFactor = window.getSettingValue('zoom-factor-setting') || 100;
window.setZoomFactor(zoomFactor / 100);
Expand Down Expand Up @@ -250,7 +254,6 @@ if (config.proxyUrl) {
window.nodeSetImmediate = setImmediate;

const data = require('./ts/data/dataInit');
const { setupi18n } = require('./ts/util/i18n');
window.Signal = data.initData();

const { getConversationController } = require('./ts/session/conversations/ConversationController');
Expand All @@ -272,9 +275,6 @@ window.getSeedNodeList = () =>
'https://seed3.getsession.org:4443/',
];

const { locale: localFromEnv } = config;
window.i18n = setupi18n(localFromEnv || 'en', localeMessages);

window.addEventListener('contextmenu', e => {
const editable = e && e.target.closest('textarea, input, [contenteditable="true"]');
const link = e && e.target.closest('a');
Expand Down
4 changes: 4 additions & 0 deletions stylesheets/_modules.scss
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@
font-weight: 300;
}

.module-conversation-list-item__header__date {
flex-shrink: 0;
}

.module-conversation-list-item__header__name--with-unread {
font-weight: 300;
}
Expand Down
4 changes: 4 additions & 0 deletions tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__
/localization/analysis
/localization/output
/localization/input
93 changes: 75 additions & 18 deletions tools/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,93 @@
**Those tools can be used to keep in sync our locale in the app between different language and with android translations**
# Tools

## Using the Python scripts

The Python scripts are located in the `tools` directory. To run a script, use the following command:

## Step 1: Find unused key locales in EN
```bash
python3 ./tools/<script>.py
```

`tools/unusedLocalizedString.py` is iterating over all root keys in _locales/en/message.json and try to find them on the code with a regex. If it does not find it, it will print a line with False.
Some key exceptions are hardcoded to not report false negative
Most of these scripts can take arguments. To see the arguments for a script, use the following command:

```bash
python3 ./tools/<script>.py --help
```

So just run:
`tools/unusedLocalizedString.py |grep False`
and double check by searching in the app if you can effectively remove those keys.
## Utiltiy

### Sort JSON

## Step 2: Sync keys between each locales on desktop
[./util/sortJson.py](./util/sortJson.py) sorts a given JSON file.

This step removes every key in all locales not found in the locale EN.
So if for example, you have a key in `it` which is not present in `en`, it will be removed and the `it` file will be written without it.
```bash
python3 ./tools/util/sortJson.py <file>
```

A summary for each language file is printed on the screen to let you know if anything was changed during the process
## Localization

`python3 tools/compareLocalizedStrings.py`
There are several script that handle localization at different stages.

### Find String

## Step 3: Map translations from android to desktop
[findString.py](./findString.py) is a utility script that searches for a given token across the codebase. This script
searches in the following directories:

This step matches translations from android to desktop. It needs to be run for each locale you want to update.
- `./ts/`

```bash
python3 ./tools/findString.py <token>
```

`python3 tools/mapAndroidTranslationsToDesktop.py fr <path_to_android_root_project>`
The script can automatically open the files in VSCode by passing the `--open` flag.

Under the hood, it uses a item from the EN desktop locale called `androidKey` to find the matching translation for each locale.
```bash
python3 ./tools/findString.py <token> --open
```

Note that if a desktop key does not have an `androidKey` set, it will just be skipped
The goal is to have an androidKey for each item, if possible. But for now apps are too different for that to make sense.
**Warning:** The --open flag will open only the first result for the token in VSCode. If you wish to open more files,
you can pass the `--limit` flag with the maximum number of files you wish to open. You can also pass the `--limit 0`
flag to open all files containing the token.

```bash
python3 ./tools/findString.py <token> --open --limit 5
```

### [CrowdIn Post-Import](./localization/crowdInPostImport.sh)

When a CrowdIn PR is made to update the localizations
the [./localization/crowdInPostInstall.sh](./localization/crowdInPostImport.sh) - This script processes the imported
files by running the following script:

- [./localization/generateLocales.py](./localization/generateLocales.py) - This script generates the TypeScript type
definitions [locales.ts](../ts/localization/locales.ts). This script also validates the dynamic variables in each
locale file and flags any errors.

The generated type file is not commited to the repository and is generated at build time. It is generated here to ensure
that changes to any type definitions are not problematic.

## [Generate Localized Strings Analysis](./localization/generateLocalizedStringsAnalysis.sh)

This script generates a report of the localized strings, identifying missing and unused strings, as well as strings that
are used but not known about. Without any input files this script outputs:

- [found_strings.csv] - A list of all strings found in the codebase.
- [not_found_strings.csv] - A list of all strings not found in the codebase.
- [potental_matches.csv] - A list of all not found strings in the codebase that have a potential match using a fuzzy
search.

The script can be run with:

```bash
python3 ./tools/localization/generateLocalizedStringsAnalysis.py
```

The script can also take the following arguments:

- `--output-dir` - The directory to output the files to. Default is `./tools/localization/analysis/`.
- `--master-strings` - A file containging a master list of strings to compare against. This list specifies the list of
known strings. When this is provided a `missing_strings.csv` file is generated. This file contains all strings in the
codebase that are not in the master list.
- `--to-be-removed` - A file containging a list of strings that are to be removed from the codebase. This list specifies
the list of strings that are to be removed and so won't be flagged as missing from the master lists. Any strings in
this list will not appear in the `missing_strings.csv` file.
18 changes: 0 additions & 18 deletions tools/afterCrowdInFetch.sh

This file was deleted.

Loading
Loading