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

Add internationalisation framework #205

Closed
wants to merge 20 commits into from
Closed

Add internationalisation framework #205

wants to merge 20 commits into from

Conversation

TomAFrench
Copy link
Contributor

There's been some interest in adding translations for languages other than english here: https://github.com/actualbudget/actual/discussions/199

I can't really work on this myself personally due time + language knowledge constraints but I'm leaving this PR open so that anyone can contribute translations to be merged into this PR and once we have more coverage then we can work on getting it merged into master (we'll need to add the ability to set the language in the UI, etc.).

For the time being you can choose which language to display by setting the lng flag in src/locales/index.js. We currently have very barebones i18n files which only handle a couple of strings on the bootstrapping page.

These files need to be filled out and new ones created for any languages we want to support. To use these these translations, all the components in the app need to be updated in a similar fashion to the Bootstrap component (please use that component as a guide).

@TomAFrench TomAFrench added good first issue Good for newcomers help wanted Extra attention is needed labels Aug 24, 2022
@TomAFrench
Copy link
Contributor Author

TomAFrench commented Aug 24, 2022

@manuelcanepa There was a couple of issues which popped up but it's pretty much there:

  1. There was a mismatch on the translation key used in the json file compared to in the React code.
  2. Templated values need to be wrapped {{twice}} instead of {once}.
  3. It seems like the t() function doesn't properly display <strong> tags so we need to use the <Trans> component in these cases.

If you run yarn start in the terminal then you should be able to check whether the translations appear correctly in the app.

@manuelcanepa
Copy link

Thanks for the corrections, im having troubles to start this project, so i make changes without running. Today i will try to start the environment to check every change that i makes.

@TomAFrench
Copy link
Contributor Author

Ok, feel free to share any errors you're getting and we can see if we can work it out together.

* master: (24 commits)
  refactor: sort imports in desktop-client alphabetically
  chore: remove unused imports from desktop-client
  adm-zip to 0.5.6
  style: prettify .eslintrc.js
  build: make eslint-plugin-prettier a dependency of desktop-client
  ci: lint desktop-client in CI
  style: fix or silence linting errors in desktop-client
  chore: update remaining test scripts
  github fix indentation in issue template
  github: update issue template
  fix: correct some re-exports which were breaking things
  fix: stop trying to transform node_modules
  fix: stop the web tests from running in node environment
  fix: add ts-jest presets which are equivalent to the old `transform` properties
  fix: add esModuleInterop so that the default imports issue goes away
  fix: stop typechecking javascript files
  chore: allow mobile package to pass with no tests
  build: replace babel-jest with ts-jest
  Update bug-report.yml
  Addition: Issue template
  ...
@manuelcanepa
Copy link

@TomAFrench I dont have write access, thats why i can't contribute directly to this PR and open #219. BTW: I notice that .editorconfig says:

[*]
indent_size = 2

And you indent json with 4 spaces, i propose you to add:

[*.json]
indent_size = 4

@TomAFrench
Copy link
Contributor Author

Whoops, sorry looks like my vscode wasn't respecting .editorconfig, that should be fixed now. I'll just use 2 spaces from now on.

I dont have write access, thats why i can't contribute directly to this PR and open #219.

Thanks, yeah making separate PRs into this branch is the way to go. I'll try to review and merge promptly.

manuelcanepa and others added 3 commits August 30, 2022 23:22
* #199 Adding translation to schedules list

* #199 Complete translation on EditSchedule Form

* #199 Translation for status badge

* #199 Minor changes, suggested by @j-f1

Co-authored-by: Tom French <[email protected]>
* master:
  fix: use correct comment style
  build: remove patch-package dependency from loot-design
  Conditionally set MSYS
  build: update yarn.lock
  build: use workspace ranges for monorepo dependencies
  changes needed to build on windows
@manuelcanepa
Copy link

manuelcanepa commented Aug 31, 2022

I think that this will be a headache to translate: https://github.com/actualbudget/actual/blob/i18n/packages/loot-core/src/shared/schedules.js

@j-f1
Copy link
Contributor

j-f1 commented Aug 31, 2022

Working on that @manuelcanepa!

* master:
  Sort import in alphabetical order (#238)
  Separate external, monorepo and internal imports (#237)
  Allow `enter` to create new transaction when focused on `cleared` column (#234)
  Enforce linting in loot-design (#233)
  style: run linter (#232)
  refactor: create index.js for aql directory (#68)
  Revert "build: update yarn.lock" (#230)
  Fix handling of -0 in budget summary (#229)
  Update bug-report.yml (#228)
@manuelcanepa
Copy link

I see that the "es" language is fixed on config. @TomAFrench What do you think about this: https://github.com/i18next/i18next-browser-languageDetector?

* #199 Adding translation to rule editor and transaction table

* Feature: Translation to discover schedule table

Fix: Some translation improvements

* fix: Fix minor after check

* Feature: More translation to account

Fix: Add *_old.json files to ignore

* Update packages/desktop-client/src/components/accounts/Account.js

Co-authored-by: Tom French <[email protected]>

* fix: Workaround for know caveats

* lint: fix import order

* fix: t is not a function when empty transactions list

* Feature: Translate account filters

* Feature: Translation on transactions table

* Feature: Translate budget and the rest of bootstrap

* Update packages/desktop-client/src/locales/es-ES.json

Co-authored-by: Jed Fox <[email protected]>

* fix: Using the new key for unknow error

* refactor: push useTranslation up above function definition, etc

* refactor: push useTranslation up above function definition

* refactor: set key for Trans component balanceType

* refactor: pass i18keys to Trans components explicitly

Co-authored-by: Tom French <[email protected]>
Co-authored-by: Jed Fox <[email protected]>
@TomAFrench
Copy link
Contributor Author

I haven't put much thought into the language selection so far. We should definitely add a dropdown to the settings page but not sure if we need this package vs storing it in local storage ourselves.

j-f1 and others added 2 commits September 8, 2022 14:37
* monthUtils.{format → nonLocalizedFormat}

* Implement localization for schedule descriptions

* Remove outdated comment

* Add general.ordinal in Spanish

Co-Authored-By: Manuel Eduardo Cánepa Cihuelo <[email protected]>

* yay time zones?

* fix: re-add missing keys

* fix: fix broken i18n imports/initialisation

* style: linting

* fix: re-add english ordinal keys

* fix: add remaining english ordinal keys

* fix: correct dates in schedules.js

* refactor: store translations keys for loot-core in loot-core

* fix: add ns to i18n.t calls directly so parser can find them

* feat: add spanish translation from manuelcanepa

* fix: add comments to help i18n-parser to find contexts

* fix: add "many" context to spanish translations

Co-authored-by: Manuel Eduardo Cánepa Cihuelo <[email protected]>
Co-authored-by: Tom French <[email protected]>
Co-authored-by: Manuel Eduardo Cánepa Cihuelo <[email protected]>
Comment on lines +45 to +46
"i18next": "^21.9.1",
"i18next-parser": "^6.5.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is on devDependencies?

@manuelcanepa
Copy link

What do we need to make this happend?

@rich-howell rich-howell added the user interface Related to the user interface label Jan 7, 2023
@MatissJanis
Copy link
Member

Closing this one off as abandoned. But linking to this PR from an issue so if someone decides to pick this up again can refer back to this PR.

#497

@MatissJanis MatissJanis deleted the i18n branch May 4, 2023 17:31
@vfaculteit
Copy link

I'd like to continue working on this, could you please reopen the i18n branch @MatissJanis? Also, for readability purposes we could directly add fallback translations, e.g., the string "Accounts" becomes t('general.accounts', "Accounts") in stead of t('general.accounts').

@manuelcanepa
Copy link

I'd like to continue working on this, could you please reopen the i18n branch @MatissJanis? Also, for readability purposes we could directly add fallback translations, e.g., the string "Accounts" becomes t('general.accounts', "Accounts") in stead of t('general.accounts').

I like it, how this works with interpolation?

@vfaculteit
Copy link

vfaculteit commented May 8, 2023

I'd like to continue working on this, could you please reopen the i18n branch @MatissJanis? Also, for readability purposes we could directly add fallback translations, e.g., the string "Accounts" becomes t('general.accounts', "Accounts") in stead of t('general.accounts').

I like it, how this works with interpolation?

This should work: e.g., `Account: ${accountName}` becomes t('general.accountWithName', {name: accountName, defaultValue: 'Account: {{name}}'}

@fabienheureux
Copy link

@vfaculteit did you start working on this ?
I might be interested to help as well, French speaker here, with experience in translating react projects.
I don't want to duplicate the effort, let me know if there are areas where you think you might need some help.

@fabienheureux
Copy link

Great, glad to see the work is in progress !
No rush in getting access to the repo, I can follow from there and check where I can be of any help, and base some work on this branch.

Are there any blockers I could help with ?

@rafacla
Copy link

rafacla commented Jul 2, 2023

Hello guys, brazilian here, can help translating to pt-BR

@maxloo2
Copy link

maxloo2 commented Aug 16, 2023

@MatissJanis will this PR be reopened?

@lelemm
Copy link
Contributor

lelemm commented Feb 5, 2024

I can help too

Hello guys, brazilian here, can help translating to pt-BR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed user interface Related to the user interface
Projects
Status: Fixed
Development

Successfully merging this pull request may close these issues.

10 participants