Apostrophe 3.3.0: Localization is here! 🎊 #3375
Replies: 2 comments
-
Hi! I've been testing this and I've few doubts/suggestions, sorry if the nomenclature is a little bit off, it's been a while since I read the docs. Here it goes: Is it possible to force all the locales to have a
|
Beta Was this translation helpful? Give feedback.
-
Thanks for these suggestions!
We do already plan to support locale switching inside the modal at some
point, as long as it's the top modal. We wanted to do it right away, but
it's a bit tricky and we didn't want to introduce bugs on the first release
of localization.
Re: having some non-localized fields, that is an interesting idea. I see
why it could be valuable, it could prevent translators from making changes
that are actually not a good idea to fields that should be left alone.
However if we let them be edited from any locale as you suggest, that would
negate some of the benefit by allowing the translator for Portuguese to
make a change that would impact all locales, possibly without even knowing
it. So it's tough to say what the best policy really is. Something to think
about.
I suggest that you submit it on our product board:
https://portal.productboard.com/apostrophecms/1-product-roadmap/tabs/1-under-consideration
As for forcing all locales to have a prefix, you have a good point about
that too. One easy workaround for now would be to redirect in browser
javascript. Right now (peeps at the middleware) it would be a bit of a pain
to do it at project level server side, which we should look at.
…On Wed, Sep 8, 2021 at 3:26 AM Asier Illarramendi ***@***.***> wrote:
Hi! I've been testing this and I've few doubts/suggestions, sorry if the
nomenclature is a little bit off, it's been a while since I read the docs.
Here it goes:
Is it possible to force all the locales to have a prefix?
Maybe it's a matter of taste, but I usually prefer to have all the locales
prefixed and redirect to the default one when entering the root path /.
Alternatively, the root / path could show a custom page with links to
different locales.
Is it possible to define non-localizable fields?
The idea here is to ease the translation process and keep consistency. So
all the locales might share the same image, but the text should be
translated. The minimum for me would be to allow this per field. The
non-localizable fields could be edited from any locale.
The ideal for me would be that also the areas, like the one in
@apostrophecms/home-page could support this. So the area widgets
reordering is reflected between locales, and image/video fields are kept
in sync, but the rich-text one can be translated. This should be
configurable.
Similarly, the array fields should be able to keep in sync. Imagine a
*Project* which has some *links* array. Assuming these only contain the
URL (so there is nothing to localize), these should be kept in sync between
locales. Otherwise it's a maintenance burden for the CMS user.
I understand this might be a pain in the ass to implement, but anything in
this direction for me it's really appreciated. If this is possible some
kind of indicator in the i18n fields would be helpful (see next section
screenshot), e.g.:
[image: image]
<https://user-images.githubusercontent.com/188612/132462103-1dcdedbe-50f3-421f-84cf-605319601819.png>
Switch between locales in Edit modal
In the Edit modal it would be very useful to switch rapidly between
locales. Something similar to what is done in Bolt:
[image: image]
<https://user-images.githubusercontent.com/188612/132461917-bed97d0a-f0cc-4a1c-b709-e3cc68c8dea9.png>
------------------------------
Thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3375 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27INBEBR3T67OSSUWQLUA4FZ7ANCNFSM5DCNKDRA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
Today we are very pleased to share our first release of Apostrophe's new localization tools. This is the result of several weeks of design and development and was influenced heavily by feedback from the community along with some major support and collaboration with our partners at Michelin. It's a big release, and the best place to dive in is right in our new docs for these features. We hope you take a moment to check those out, but for right now here are some notable highlights:
For a quick example of the content localization features check out this video below.
Bonjour.le.monde.mov
In the days ahead, we will be updating our public demo to show off some specific multi-locale configurations. For now, the best way to try out these tools yourself is to update your project to 3.3 and follow the documentation to set up some locales.
This is a huge step forward for A3 and we think it is a big improvement over the experience of localizing content in A2. We are really excited to get this out there, and looking forward to feedback from the community. Please don't hesitate to open any new issues on GitHub with any specific questions, suggestions, or bug reports. Also, please do reach out to us if you'd like to contribute some translations of the Apostrophe UI.
As always, read on for the full details from this latest release:
Apostrophe 3.3.0
Fixes
AposCellDate
, which can be optionally used in manage views of pieces. Thanks to Miro Yovchev for this fix.Adds
B
with the draft contents of localeA
.prefix
andhostname
options, which are automatically recognized by middleware that removes the prefix dynamically where appropriate and setsreq.locale
. In 3.x this works more like the global siteprefix
option. This is a departure from 2.x which stored the prefix directly in the slug, creating maintenance issues.prefix
orhostname
. A helpful error message is displayed if this is not the case.title
or_url
).@apostrophecms/i18n
module now usesi18next
to implement static localization. All phrases in the Vue-based admin UI are passed throughi18next
viathis.$t
, andi18next
is also available viareq.t()
in routes and__t()
in templates. Apostrophe's own admin UI phrases are in theapostrophe
namespace for a clean separation. An array of locale codes, such asen
orfr
oren-au
, can be specified using thelocales
option to the@apostrophecms/i18n
module. The first locale is the default, unless thedefaultLocale
option is set. If no locales are set, the locale defaults toen
. Thei18next-http-middleware
locale guesser is installed and will select an available locale if possible, otherwise it will fall back to the default.v-tooltip
has been extended asv-apos-tooltip
, which passes phrases throughi18next
.data.localizations
in any page template. Each element always haslocale
,label
andhomePageUrl
properties. Each element also has anavailable
property (if true, the current context document is available in that locale),title
and a small number of other document properties are populated, and_url
redirects to the context document in that locale. The current locale is marked withcurrent: true
.this.$t
helper provided in Vue also accepts an object argument with akey
property. Additional properties may be used for interpolation.i18next
localization JSON files can be added to thei18n
subdirectory of any module, as long as itsi18n
option is set. Thei18n
object may specifyns
to give ani18next
namespace, otherwise phrases are in the default namespace, used when no namespace is specified with a:
in ani18next
call. The default namespace is yours for use at project level. Multiple modules may contribute to the same namespace.APOS_DEBUG_I18N=1
is set in the environment, thei18next
debug flag is activated. For server-side translations, i.e.req.t()
and__t()
, debugging output will appear on the server console. For browser-side translations in the Vue admin UI, debugging output will appear in the browser console.APOS_SHOW_I18N=1
is set in the environment, all phrases passed throughi18next
are visually marked, to make it easier to find those that didn't go throughi18next
. This does not mean translations actually exist in the JSON files. For that, review the output ofAPOS_DEBUG_I18N=1
.req.clone(properties)
method is now available. This creates a clone of thereq
object, optionally passing in an object of properties to be set. The use ofreq.clone
ensures the new object supportsreq.get
and other methods of a truereq
object. This technique is mainly used to obtain a new request object with the same privileges but a different mode or locale, i.e.mode: 'published'
.req.__()
,res.__()
and__()
localization helpers, which were never official or documented in 3.x but may be in use in projects ported from 2.x. These wrappers do not localize but do output the input they are given along with a developer warning. You should migrate them to usereq.t()
(in server-side javascript) or__t()
(Nunjucks templates).Changes
Apostrophe 3.x extensions
redirect 3.0.1
autopublish: true
was used by the module, butlocalize: false
is more appropriate as it eliminates multiple locale versions altogether. A migration has been added to take care of existing redirects in this transition.withType
andstatusCode
options.Apostrophe 2.220.5
Apostrophe 2.x extensions
apostrophe-forms 1.10.4
self.getOption
to fetch the recaptcha options for full compatibility withapostrophe-override-options
.apostrophe-security-headers 1.0.1
Referrer-Policy
,X-Content-Type-Options
andPermissions-Policy
were inadvertently left off a list that allows them to be configured. The default values for the first two are now as was always intended. The third is not enabled by default but can now optionally be configured.apostrophe-workflow 2.39.4
Other modules
moog-require 1.3.1
Beta Was this translation helpful? Give feedback.
All reactions