Skip to content

Commit

Permalink
localise
Browse files Browse the repository at this point in the history
  • Loading branch information
mayel committed Dec 16, 2023
1 parent 6b3b9a9 commit e545afc
Show file tree
Hide file tree
Showing 18 changed files with 3,957 additions and 2,081 deletions.
133 changes: 78 additions & 55 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,68 +1,91 @@
[main]
host = https://www.transifex.com

[bonfire.priv-localisation-bonfire-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire.po
source_file = priv/localisation/bonfire.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-boundaries-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_boundaries.po
source_file = priv/localisation/bonfire_boundaries.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-invite-links-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_invite_links.po
source_file = priv/localisation/bonfire_invite_links.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-common-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_common.po
source_file = priv/localisation/bonfire_common.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-ui-me-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_ui_me.po
source_file = priv/localisation/bonfire_ui_me.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-federate-activitypub-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_federate_activitypub.po
source_file = priv/localisation/bonfire_federate_activitypub.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-federate-activitypub-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_federate_activitypub.po
source_file = priv/localisation/bonfire_federate_activitypub.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-invite-links-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_invite_links.po
source_file = priv/localisation/bonfire_invite_links.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-ui-social-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_ui_social.po
source_file = priv/localisation/bonfire_ui_social.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-me-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_me.po
source_file = priv/localisation/bonfire_me.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-social-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_social.po
source_file = priv/localisation/bonfire_social.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire.po
source_file = priv/localisation/bonfire.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-boundaries-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_boundaries.po
source_file = priv/localisation/bonfire_boundaries.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-search-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_search.po
source_file = priv/localisation/bonfire_search.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-me-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_me.po
source_file = priv/localisation/bonfire_me.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-social-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_social.po
source_file = priv/localisation/bonfire_social.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-common-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_common.po
source_file = priv/localisation/bonfire_common.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-ui-common-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_ui_common.po
source_file = priv/localisation/bonfire_ui_common.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-ui-common-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_ui_common.po
source_file = priv/localisation/bonfire_ui_common.po
source_lang = en
type = PO
[o:bonfire:p:bonfire:r:priv-localisation-bonfire-ui-me-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_ui_me.po
source_file = priv/localisation/bonfire_ui_me.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[o:bonfire:p:bonfire:r:priv-localisation-bonfire-ui-social-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_ui_social.po
source_file = priv/localisation/bonfire_ui_social.po
source_lang = en
type = PO
replace_edited_strings = false
keep_translations = false

[bonfire.priv-localisation-bonfire-search-po--main]
file_filter = priv/localisation/<lang>/LC_MESSAGES/bonfire_search.po
source_file = priv/localisation/bonfire_search.po
source_lang = en
type = PO
8 changes: 4 additions & 4 deletions flavours/classic/config/bonfire_data.exs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ common_assocs = %{
### Mixins

# A summary of an object that can appear in a feed.
activity: quote(do: has_one(:activity, unquote(Activity), unquote(mixin))),
# activity: quote(do: has_one(:activity, unquote(Activity), unquote(mixin))),

# retrieves the Create activity
activity: quote(do: has_one(:activity, unquote(Activity), foreign_key: :id, references: :id)),

# Indicates the entity responsible for an activity. Sort of like creator, but transferrable. Used
# during deletion - when the caretaker is deleted, all their stuff will be too.
Expand Down Expand Up @@ -372,9 +375,6 @@ common_assocs = %{
activities:
quote(do: has_many(:activities, unquote(Activity), foreign_key: :object_id, references: :id)),

# retrieves the Create activity
activity: quote(do: has_one(:activity, unquote(Activity), foreign_key: :id, references: :id)),

### Stuff I'm not sure how to categorise yet

# Used currently only for requesting to follow a user, but more general
Expand Down
2 changes: 1 addition & 1 deletion flavours/classic/config/flavour_assets/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function ns(hooks, nameSpace) {
return updatedHooks
}

import * as c1 from "./Bonfire.Editor.Milkdown.hooks"
import * as c1 from "./Bonfire.Editor.Milkdown.hooks"
import * as c2 from "./Bonfire.UI.Common.ViewCodeLive.hooks"
import * as c3 from "./Bonfire.UI.Common.PreviewContentLive.hooks"
import * as c4 from "./Bonfire.UI.Common.NotificationLive.hooks"
Expand Down
5 changes: 3 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -759,11 +759,12 @@ audit:
AS_UMBRELLA=1 just mix sobelow

# Extract strings to-be-localised from the app and installed extensions
# FIXME: should extract to root app, not activity_pub like it's doing (for whatever reason)
localise-extract:
just mix "bonfire.localise.extract"
mv extensions/activity_pub/priv/localisation* priv/localisation/
cd priv/localisation/ && for f in *.pot; do mv -- "$f" "${f%.pot}.po"; done
# TODO: copy .pot strings from extensions/deps
# cp extensions/*/priv/gettext/* priv/localisation/
# cp forks/*/priv/gettext/* priv/localisation/

@localise-tx-init:
pip install transifex-client
Expand Down
20 changes: 9 additions & 11 deletions lib/mix/mixer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ if not Code.ensure_loaded?(Bonfire.Mixer) do
do:
(config[:deps] || config)
# |> IO.inspect(limit: :infinity)
|> Enum.filter(&include_dep?(deps_subtype, &1, config))
|> Enum.filter(&include_dep?(deps_subtype, &1, config[:deps_prefixes][deps_subtype]))

def deps_names_for(type, deps \\ mix_config()) do
deps(deps, type)
def deps_names_for(type, config \\ mix_config()) do
deps(config, type)
|> Enum.map(&dep_name/1)
end

Expand Down Expand Up @@ -68,8 +68,8 @@ if not Code.ensure_loaded?(Bonfire.Mixer) do
end

def mix_config do
if function_exported?(Mix.Project, :config, 0),
do: Mix.Project.config(),
if function_exported?(Bonfire.Umbrella.MixProject, :config, 0),
do: Bonfire.Umbrella.MixProject.config(),
else: Bonfire.Application.config()
end

Expand Down Expand Up @@ -128,8 +128,8 @@ if not Code.ensure_loaded?(Bonfire.Mixer) do
[path: "deps.path", git: "deps.git", hex: "deps.hex"]
]

def deps_to_clean(deps, type) do
deps(deps, type)
def deps_to_clean(config, type) do
deps(config, type)
|> deps_names()
|> or_unused()
end
Expand Down Expand Up @@ -274,12 +274,10 @@ if not Code.ensure_loaded?(Bonfire.Mixer) do
do: unpinned_git_dep?(dep)

# defp include_dep?(:docs = type, dep, deps_prefixes), do: String.starts_with?(dep_name(dep), deps_prefixes || @config[:deps_prefixes][type]) || git_dep?(dep)
def include_dep?(type, dep, config_or_prefixes) do
prefix = config_or_prefixes[:deps_prefixes][type] || config_or_prefixes[type] || "bonfire"

def include_dep?(type, dep, prefixes) do
String.starts_with?(
dep_name(dep),
prefix
prefixes
)
end

Expand Down
5 changes: 4 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ defmodule Bonfire.Umbrella.MixProject do
"bonfire_ui_social"
],
localise: ["bonfire"],
localise_self: []
localise_self: [
# FIXME: should extract to root app, not activity_pub like it's doing (for whatever reason)
"activity_pub"
]
],
deps:
Mess.deps(Mixer.mess_sources(@default_flavour), @extra_deps,
Expand Down
Loading

0 comments on commit e545afc

Please sign in to comment.