Skip to content

Commit

Permalink
refactor(l10n): Migrate to Fluent (#42)
Browse files Browse the repository at this point in the history
* chore(i18n): Initial FTL

* chore: Comments

* feat: Actually add Fluent

* feat: Actually load fluent resources

* fix: Actually allow locales to be fetched

* fix: Ternary operator quirk

* refactor: Change l10n naming convention
There's no fixed right way for l10n naming convention for ProjectFluent as far as I know

* chore(l10n): Migrate card locale to FTL

* docs: Comment [skip ci]

* refactor: Rename locale from index.ftl to app.ftl

* feat: Actually load setting locale to FTL

* feat: Init another lang

* fix: Re-fetch on locale change

* refactor: Use @fluent/react's React Overlay

* docs: Explicitly state the importance of the formatting [skip ci]

* chore: Add missing translation

* docs: More comment [skip ci]

* chore: Translate badge
Also translate previously untranslatable badges

* chore: Translate birthday
Untested, Rebased exclusive feature.

* refactor: Simplify fallback
We need those stuff anyway for fallback, so let's just store it in a variable

* chore: Translate more stuff

* chore: Remove migrated translations
So that it's easier to track

* chore: More translation migration

* chore: Migrated endorse translations

* chore: Migrated familiar followers

* fix: Migrated all badges

* chore(l10n): Migrated followers, no-followers, and number formatting

* fix: Missing follows you badge translation

* chore(l10n): Migrated following and no-following

* chore: Removed unused key

* fix: Fluent checker
I forgot that react-intl also use id

* chore(l10n): Migrated profile banner

* chore(l10n): Migrated hide reposts

* chore(l10n): Migrated last status

* chore(l10n): Migrated about page's "available in"

* fix: Missing and incorrect translation

* chore(l10n): Migrated link verified-on

* chore(l10n): Migrated account-locked

* chore(l10n): Migrated login

* fix: Add missing translation

* chore(l10n): Migrated media

* chore(l10n): Migrated member-since

* fix: Duplicate

* chore(l10n): Migrated mention

* chore(l10n): Migrated mute/unmute

* chore(l10n): Migrated more translation
- posts
- posts-with-replies
- never-active
- profile
- profile-external
- register

* chore(l10n): Migrated more translations
- remote-follow
- remove-from-follower
- requested
- rss-feed
- share
- show-reposts
- subscribe notif
- unsubscribe notif

* fix: Missing value

* chore(l10n): More translation migration
- unblock
- unblock-domain
- verified
  • Loading branch information
null2264 authored Oct 28, 2023
1 parent 9e9603b commit 8db55d1
Show file tree
Hide file tree
Showing 55 changed files with 2,320 additions and 1,690 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
"@babel/runtime": "^7.20.13",
"@emoji-mart/data": "^1.1.2",
"@floating-ui/react": "^0.24.0",
"@fluent/bundle": "^0.18.0",
"@fluent/langneg": "^0.7.0",
"@fluent/react": "^0.15.2",
"@fontsource/nunito-sans": "^5.0.8",
"@fontsource/roboto-mono": "^4.5.8",
"@formatjs/icu-messageformat-parser": "^2.6.0",
Expand Down Expand Up @@ -131,7 +134,7 @@
"intersection-observer": "^0.12.2",
"intl-messageformat": "9.13.0",
"intl-messageformat-parser": "^6.4.4",
"intl-pluralrules": "^1.3.1",
"intl-pluralrules": "^2.0.1",
"jsonwebtoken": "^9.0.0",
"leaflet": "^1.8.0",
"libphonenumber-js": "^1.10.8",
Expand Down
35 changes: 35 additions & 0 deletions src/locales/en-GB/app.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
### British English Localization for Ghostbox

# Please read top comment in en-US/app.ftl for more information.

### Terms
-back =
{ $case ->
*[title] Back
[lower] back
}
-brand-name = Ghostbox
-collapse =
{ $case ->
*[title] Collapse
[lower] collapse
}
-expand =
{ $case ->
*[title] Expand
[lower] expand
}
### Modules

### UI (components/ui/)

# Common components, not exclusive to specific module.

## Accordion (components/ui/accordion/...)

## Card (components/ui/card/...)

### Account (features/account/...)

# Components that related to Account such as profile, hover card.
182 changes: 182 additions & 0 deletions src/locales/en-US/app.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
### Localization for Ghostbox

# Naming convention for l10n IDs: "module-ComponentName--string-summary".
# Please sort alphabetically by (module name, component name).

# -- Special Cases --
# This is for special cases where the translation have to be formatted in a
# specific way, these translations should be prefixed with "--Case".
#
# The format should not be changed!
# You should only change the "TEXT GOES HERE!" text!
#
# - MenuItem
# ID convention: "module-ComponentName--string-summary--MenuItem"
# Formatting: { -icon }<wrapper>TEXT GOES HERE!</wrapper>{ -emblem }
# Attrs:
# - title
# - Icon
# ID convention: "module-ComponentName--string-summary--Icon"
# Formatting: { -icon }TEXT GOES HERE!

### Terms
# You don't need to add every new term here, just add if needed (e.g. the term is commonly used).
-back =
{ $case ->
*[title] Back
[lower] back
}
-brand-name = Ghostbox
-collapse =
{ $case ->
*[title] Collapse
[lower] collapse
}
-emblem = <emblem></emblem>
-expand =
{ $case ->
*[title] Expand
[lower] expand
}
-icon = <icon></icon>
-accounts = <accounts></accounts>
-display-name = <name></name>
### Modules

### UI (components/ui/)

# Common components, not exclusive to specific module.

## Accordion (components/ui/accordion/...)
ui-Accordion--collapse =
.title = { -collapse }
ui-Accordion--expand =
.title = { -expand }
## Card (components/ui/card/...)
ui-CardHeader--back =
.aria-label = { -back }
.title = { -back }
### About (features/about)
about-Page--available = Available in:
### Account (features/account/...)

# Components that related to Account such as profile, hover card.

-edit-profile = Edit profile
account-Action--login = Sign in
account-Action--register = Sign up
account-Action--share =
.title = Share @{ $name }'s profile
account-Action--subscribe =
.title = Subscribe to notifications from @{ $name }
account-Action--unsubscribe =
.title = Unsubscribe to notifications from @{ $name }
account-Badge--admin = Admin
account-Badge--bot = Bot
account-Badge--moderator = Moderator
account-Badge--patron = Patron
# someone messed up the translation (coding error)
account-Badge--opaque = INVALID!
account-Birthday--date--Icon = { -icon }{ DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = Born { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--date = Born { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = Born { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--celebration = Birthday is today!
account-Header--banner =
.alt = Profile header
account-Header--chat =
.title = Chat with @{ $name }
account-Header--copy--MenuItem = { -icon }<wrapper>Copy link to profile</wrapper>{ -emblem }
.title = Copy link to profile
account-Header--direct--MenuItem = { -icon }<wrapper>Direct message @{ $name }</wrapper>{ -emblem }
.title = Direct message @{ $name }
account-Header--edit-profile--MenuItem = { -icon }<wrapper>{ -edit-profile }</wrapper>{ -emblem }
.title = { -edit-profile }
account-Header--endorse--MenuItem = { -icon }<wrapper>Feature on profile</wrapper>{ -emblem }
.title = Feature on profile
account-Header--hide-reposts--MenuItem = { -icon }<wrapper>Hide reposts from @{ $name }</wrapper>{ -emblem }
.title = Hide reposts from @{ $name }
account-Header--manage-list--MenuItem = { -icon }<wrapper>Add or Remove from lists</wrapper>{ -emblem }
.title = Add or Remove from lists
account-Header--mention--MenuItem = { -icon }<wrapper>Mention</wrapper>{ -emblem }
.title = Mention
account-Header--profile-external--MenuItem = { -icon }<wrapper>View profile on { $domain }</wrapper>{ -emblem }
.title = View profile on { $domain }
account-Header--remove-follower--MenuItem = { -icon }<wrapper>Remove this follower</wrapper>{ -emblem }
.title = Remove this follower
account-Header--report--MenuItem = { -icon }<wrapper>Report @{ $name }</wrapper>{ -emblem }
.title = Report @{ $name }
account-Header--rss-subscribe--MenuItem = { -icon }<wrapper>Subscribe to RSS feed</wrapper>{ -emblem }
.title = Subscribe to RSS feed
account-Header--search--MenuItem = { -icon }<wrapper>Search from @{ $name }</wrapper>{ -emblem }
.title = Search from @{ $name }
account-Header--search-self--MenuItem = { -icon }<wrapper>Search your posts</wrapper>{ -emblem }
.title = Search your posts
account-Header--share--MenuItem = { -icon }<wrapper>Share @{ $name }'s profile</wrapper>{ -emblem }
.title = Share @{ $name }'s profile
account-Header--show-reposts--MenuItem = { -icon }<wrapper>Show reposts from @{ $name }</wrapper>{ -emblem }
.title = Show reposts from @{ $name }
account-Header--unendorse--MenuItem = { -icon }<wrapper>Don't feature on profile</wrapper>{ -emblem }
.title = Don't feature on profile
account-Label--followers = Followers
account-Label--following = Following
account-Label--posts = Posts
account-Label--posts-with-replies = Posts and replies
account-Link--verified-on =
.title = Ownership of this link was checked on { DATETIME($date, month: "short", day: "numeric", year: "numeric", hour: "numeric", minute: "2-digit") }
account-Page--media = Media
account-Page--profile = Profile
account-Status--block = Blocked
account-Status--deactivated = Deactivated
account-Status--domain-block = Domain blocked
account-Status--follows-you = Follows you
account-Status--familiar-followers = Followed by { -accounts }
account-Status--familiar-followers-empty = No one you know follows { -display-name }
account-Status--familiar-followers-more =
{ $count ->
[one] { $count } other you follow
*[other] { $count } others you follow
}
account-Status--last-status = Last active
account-Status--locked =
.alt = This account privacy status is set to locked. The owner manually reviews who can follow them.
account-Status--member-since = Joined { DATETIME($date, year: "numeric", month: "long") }
account-Status--muted = Muted
account-Status--never-active = Never
account-Status--no-followers = No one follows this user yet.
account-Status--no-following = This user doesn't follow anyone yet.
account-Status--requested = Awaiting approval
account-Status--verified =
.alt = Verified Account
account-StatusAction--block = Block @{ $name }
account-StatusAction--block--MenuItem = { -icon }<wrapper>Block @{ $name }</wrapper>{ -emblem }
.title = Block @{ $name }
account-StatusAction--block-domain--MenuItem = { -icon }<wrapper>Hide everything from { $domain }</wrapper>{ -emblem }
.title = Hide everything from { $domain }
account-StatusAction--edit-profile = { -edit-profile }
account-StatusAction--follow = Follow
account-StatusAction--follow-remote = Remote follow
account-StatusAction--mute = Mute @{ $name }
account-StatusAction--mute--MenuItem = { -icon }<wrapper>Mute @{ $name }</wrapper>{ -emblem }
.title = Mute @{ $name }
account-StatusAction--unblock = Unblock @{ $name }
account-StatusAction--unblock--MenuItem = { -icon }<wrapper>Unblock @{ $name }</wrapper>{ -emblem }
.title = Unblock @{ $name }
account-StatusAction--unblock-domain=
.title = Show { $domain }
account-StatusAction--unblock-domain--MenuItem = { -icon }<wrapper>Show { $domain }</wrapper>{ -emblem }
.title = Show { $domain }
account-StatusAction--unfollow = Unfollow
account-StatusAction--unmute = Unmute @{ $name }
account-StatusAction--unmute--MenuItem = { -icon }<wrapper>Unmute @{ $name }</wrapper>{ -emblem }
.title = Unmute @{ $name }
account-Toast--endorsed = You are now featuring @{ $acct } on your profile
account-Toast--unendorsed = You are no longer featuring @{ $acct }
account-Toast--subscribe-fail = An error occurred trying to subscribe to this account.
account-Toast--subscribe-success = You have subscribed to this account
account-Toast--unsubscribe-fail = An error occurred trying to unsubscribe to this account.
account-Toast--unsubscribe-success = You have unsubscribed to this account
122 changes: 122 additions & 0 deletions src/locales/id-ID/app.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
### Bahasa Indonesia Localization for Ghostbox

# Mohon untuk membaca komentar paling atas dalam file en-US/app.ftl untuk informasi lebih lanjut.

### Terms
-brand-name = Ghostbox
-emblem = <emblem></emblem>
-icon = <icon></icon>
### Modules

### UI (components/ui/)

# Common components, not exclusive to specific module.

## Accordion (components/ui/accordion/...)
ui-Accordion--collapse =
.title = Tutup
ui-Accordion--expand =
.title = Buka
## Card (components/ui/card/...)
ui-CardHeader--back =
.aria-label = Kembali
.title = Kembali
### About (features/about)
about-Page--available = Tersedia di:
### Account (features/account/...)

# Components that related to Account such as profile, hover card.

-edit-profile = Ubah profil
account-Action--login = Masuk
account-Action--register = Daftar
account-Action--share =
.title = Bagikan profil @{ $name }
account-Action--subscribe =
.title = Langganan ke notifikasi dari @{ $name }
account-Action--unsubscribe =
.title = Berhenti langganan notifikasi dari @{ $name }
account-Birthday--date--Icon = { -icon }{ DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = Lahir tanggal { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--date = Lahir tanggal { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
.title = Lahir tanggal { DATETIME($date, year: "numeric", month: "short", day: "numeric") }
account-Birthday--celebration = Lahir hari ini!
account-Header--banner =
.alt = Header profil
account-Header--copy--MenuItem = { -icon }<wrapper>Salin tautan ke profil</wrapper>{ -emblem }
.title = Salin tautan ke profil
account-Header--edit-profile--MenuItem = { -icon }<wrapper>{ -edit-profile }</wrapper>{ -emblem }
.title = { -edit-profile }
account-Header--endorse--MenuItem = { -icon }<wrapper>Tampilkan di profil</wrapper>{ -emblem }
.title = Tampilkan di profil
account-Header--hide-reposts--MenuItem = { -icon }<wrapper>Sembunyikan repost dari @{ $name }</wrapper>{ -emblem }
.title = Sembunyikan repost dari @{ $name }
account-Header--manage-list--MenuItem = { -icon }<wrapper>Tambah atau Hapus dari daftar</wrapper>{ -emblem }
.title = Tambah atau Hapus dari daftar
account-Header--mention--MenuItem = { -icon }<wrapper>Balasan</wrapper>{ -emblem }
.title = Balasan
account-Header--profile-external--MenuItem = { -icon }<wrapper>Lihat profil di { $domain }</wrapper>{ -emblem }
.title = Lihat profil di { $domain }
account-Header--remove-follower--MenuItem = { -icon }<wrapper>Hapus pengikut ini</wrapper>{ -emblem }
.title = Hapus pengikut ini
account-Header--report--MenuItem = { -icon }<wrapper>Laporkan @{ $name }</wrapper>{ -emblem }
.title = Laporkan @{ $name }
account-Header--rss-subscribe--MenuItem = { -icon }<wrapper>Langganan ke umpan RSS</wrapper>{ -emblem }
.title = Langganan ke umpan RSS
account-Header--search--MenuItem = { -icon }<wrapper>Cari dari @{ $name }</wrapper>{ -emblem }
.title = Cari dari @{ $name }
account-Header--search-self--MenuItem = { -icon }<wrapper>Cari postingan anda</wrapper>{ -emblem }
.title = Cari postingan anda
account-Header--share--MenuItem = { -icon }<wrapper>Bagikan profil @{ $name }</wrapper>{ -emblem }
.title = Bagikan profil @{ $name }
account-Header--show-reposts--MenuItem = { -icon }<wrapper>Tampilkan repost dari @{ $name }</wrapper>{ -emblem }
.title = Tampilkan repost dari @{ $name }
account-Header--unendorse--MenuItem = { -icon }<wrapper>Jangan tampilkan di profil</wrapper>{ -emblem }
.title = Jangan tampilkan di profil
account-Label--followers = Pengikut
account-Label--following = Mengikuti
account-Label--posts = Postingan
account-Label--posts-with-replies = Postingan dan Balasan
account-Link--verified-on =
.title = Kepemilikan tautan ini telah diverifikasi pada { DATETIME($date, month: "short", day: "numeric", year: "numeric", hour: "numeric", minute: "2-digit") }
account-Page--profile = Profil
account-Status--block = Terblokir
account-Status--deactivated = Dinonaktifkan
account-Status--domain-block = Domain terblokir
account-Status--follows-you = Mengikuti anda
account-Status--last-status = Terakhir aktif
account-Status--locked =
.alt = Status privasi akun ini disetel untuk dikunci. Pemilik secara manual meninjau siapa yang dapat mengikuti mereka.
account-Status--member-since = Terdaftar sejak { DATETIME($date, year: "numeric", month: "long") }
account-Status--muted = Dibisukan
account-Status--never-active = Tidak pernah
account-Status--no-followers = Tidak ada yang mengikuti pengguna ini saat ini.
account-Status--no-following = Pengguna ini belum mengikuti siapapun.
account-Status--requested = Menunggu persetujuan
account-Status--verified =
.alt = Akun Terverifikasi
account-StatusAction--block = Blokir @{ $name }
account-StatusAction--block--MenuItem = { -icon }<wrapper>Blokir @{ $name }</wrapper>{ -emblem }
.title = Blokir @{ $name }
account-StatusAction--block-domain--MenuItem = { -icon }<wrapper>Sembunyikan segalanya dari { $domain }</wrapper>{ -emblem }
.title = Sembunyikan segalanya dari { $domain }
account-StatusAction--edit-profile = { -edit-profile }
account-StatusAction--follow = Ikuti
account-StatusAction--mute = Bisukan @{ $name }
account-StatusAction--mute--MenuItem = { -icon }<wrapper>Bisukan @{ $name }</wrapper>{ -emblem }
.title = Bisukan @{ $name }
account-StatusAction--unblock = Hapus blokir @{ $name }
account-StatusAction--unblock--MenuItem = { -icon }<wrapper>Hapus blokir @{ $name }</wrapper>{ -emblem }
.title = Hapus blokir @{ $name }
account-StatusAction--unblock-domain=
.title = Tampilkan { $domain }
account-StatusAction--unblock-domain--MenuItem = { -icon }<wrapper>Tampilkan { $domain }</wrapper>{ -emblem }
.title = Tampilkan { $domain }
account-StatusAction--unfollow = Berhenti mengikuti
account-StatusAction--unmute = Berhenti membisukan @{ $name }
account-StatusAction--unmute--MenuItem = { -icon }<wrapper>Berhenti membisukan @{ $name }</wrapper>{ -emblem }
.title = Berhenti membisukan @{ $name }
Loading

0 comments on commit 8db55d1

Please sign in to comment.