This is an announcement of a release of
YAMS: Yet Another Multilingual Solution for MODx Evolution and earlier versions.
YAMS is a highly configurable multilingual solution that doesn’t require the user to maintain multiple document trees and which allows the user to work with existing document templates.
YAMS 1.1.9 is the latest official stable release and is available from
the MODx repository.
This release fixes several bugs in YAMS 1.1.7 alpha RC7 and YAMS 1.1.8. It includes multilingual alias and SEO Strict style functionality. There are still some
known bugs yet to be fixed.
The latest release candidate is
YAMS 1.2.0 RC3 and fixes a bug which would cause the [tt][[YAMS? &get=`data` ... ]][/tt] snippet call to incorrectly output content obtained from monolingual documents.
YAMS has been developed on MODx Evolution v0.9.6.3 and with the latest version of PHP (>=5.2.9). I haven’t made any effort as yet to make it backwards compatible with older versions of either.
YAMS will not work with PHP 4 since it makes use of PHP 5 classes. It has been tested on MODx Evolution v0.9.6.3 up to v1.0.3.
History
Version 1.1.9
- Bug Fix: Fixed a bug introduced at version 1.1.8, which breaks ((yams_data:..))
- Bug Fix: Applied kongo09’s patch, which fixes a bug whereby default content is
not copied over to new fields when multilingual tvs are associated with new templates.
http://modxcms.com/forums/index.php/topic,43821.0.html
Version 1.1.8
- Updated YAMS ManagerManager rules so that when hide fields is on, multilingual aliases are hidden when multilingual aliases are switched off and the standard document alias is hidden when multilingual aliases are switched on.
- Updated the documentation for Hide Fields accordingly.
- Bug Fix: Fixed a <p> that should have been a </p> in the module
- Updated the forum link to
http://modxcms.com/forums/index.php/board,381.0.html
- Added a title field to the YAMS ditto extender. This outputs the page title.
- Bug Fix: Corrected a typo str2lower -> strtolower.
This bug fix is necessary for YAMS to work over HTTPS.
Reported by noes:
http://modxcms.com/forums/index.php/topic,42752.0.html
- Added an additional check to prevent crashing if $modx->documentObject doesn’t exist.
- Made the Expand function public.
- Bug Fix: Fixed a bug whereby the current language would be lost when changing page using ditto pagination and unique multilingual aliases.
- Bug Fix: Corrected a problem with switching languages when using unique multilingual aliases.
- Improved installation instructions.
- Bug Fix: Fixed a bug whereby YAMS ManagerManager rules would be applied to all (rather than no) templates when no multilingual templates are specified.
- Documentation updates
Version 1.1.7 alpha RC7
- Included @French Fries’ Wayfinder breadcrumbs templates and updated the How To?
documentation.
- Included an option to turn off automatic redirection to the correct multilingual
URL when standard MODx style URLs are encountered for specified document ids.
- Bug fix: MODx default behaviour is that when a document not assigned any alias
it is instead referred to by its id. This wasn’t implemented. Done now, except
that for multilingual documents with unique aliases on, the documents are
referred to by langId-docId.
- Removed a system event log command that was added for debugging purposes but
accidentally left in the code.
Version 1.1.7 alpha RC6
- Most of the languageicons have been removed from the distribution. The full
set can be downloaded from
http://www.languageicon.org/
- Removed the ’do you want to allow YAMS to manager multilingual variables’ option
from the multilingual templates tab.
- Tweaks to the module interface to make it easier to to find submit buttons.
- Removed some unneeded checks in frequently executed code for efficiency
- Bug Fix: Fixed a couple of errors whereby YAMS was trying to access a regexp
match that was undefined (rather than empty)
- Bug Fix: Fixed an error that could potentially result in YAMS not correctly
identifying an HTTPS connection.
- Efficiency improvements.
1) YAMS removes empty constructs instead of processing them.
2) When loading monolingual documents, now only the default language variant is
parsed. Previously all language variants were parsed but only one was served.
Monolingual documents will be served approx 1/n times faster, where n is the
number of languages.
3) As soon as a document is loaded from cache YAMS now strips out superfluous
language variants. Previously it evaluated all language variants but served
just one. For documents with a lot of uncachable content this can lead to an
improvement in speed of approx 1/n, where n is the number of languages.
- Bug Fix: Updated the managermanager rules to fix a bug whereby if more than one
custom tv was assigned to a language, only the last would be tabified.
Version 1.1.7 alpha RC5
- Bug fix: Fixed a bug whereby on first save of a newly created multilingual
document, pagetitles and aliases would not get updated.
- Bug fix: Fixed an URL encoding issue. The php header function accepts
a plain text URL, but YAMS was passing it an HTML encoded URL.
- Bug fix: The new multilingual URL capability had broken query parameter mode
and non-friendly URLs. Fixed.
Version 1.1.7 alpha RC4
- Now, if YAMS doesn’t recognise an URL as being valid, but MODx does, then YAMS
will redirect from the MODx recognised URL to the correct URL using the status
codes defined on the ’Other Params’ tab, rather than generating 404 not found.
(This aids compatibility with existing MODx resources that don’t understand
multilingual URLs and is what YAMS used to do in previous versions before I broke
it!)
Version 1.1.7 alpha RC3
- Bug fix: Corrected an .htaccess bug.
http://modxcms.com/forums/index.php/topic,36513.msg243901.html#msg243901
Version 1.1.7 alpha RC2
- Bug fix: Corrected a small URL encoding bug.
- Included an option to make MODx stripAlias optional for multilingual aliases.
- YAMS now does automatic updating of aliases, checking for unique aliases and
checking for duplicate aliases.
- Updated the YAMS managermanager rules so that they work with the latest version
of managermanager (0.3.4), which refers to tvs by name instead of id like MODx.
YAMS should be backwards compatible with older versions of both mm and MODx.
- Bug fix: Corrected a dodgy regexp which was causing URL resolution problems
when installing into a subdirectory.
- Updated the friendly URL config to include standard MODx stuff (avoids
confusion about whether it should be there or not)
- Updated the root name trailing slash redirection to be consistent with apache
guidelines.
- stripAlias is now implemented for multilingual URLs. Need to check that it
works on pre-Evo installs.
- stripAlias can result in empty aliases. Need to handle that.
- Implemented automatic pagetitle update
- Implemented better document pagetitle synchronisation
- Started implementing automatic alias updating.
- Bug fix: YAMS could return HTTP OK for monolingual documents with an extra
root name prefix. Fixed. Now permanent redirects to correct monolingual URL.
- Implemented mime dependent aliases. Currently not possible to set the
mime-alias map via the module interface.
- Modified the YAMS to encode tv names in the same way that MODx does for
0.9.6.3 and earlier versions. (Previously the encoding was not done in
completely the same way.)
- Altered the PreParse method to prevent the recursion limit from being reached
on complicated documents. It now returns a flag that says whether it needs to
be called again.
- Tidied up the comments in the code a bit.
- Bug fix: Corrected a missing variable declaration in yams.module.inc.php
Version 1.1.7 alpha RC1
- Bug fix: Corrected (I hope) and URL bug which would affect documents nested
at level 2 and greater when using friendly alias paths.
Version 1.1.6 alpha
- Added SEO Strict style URL functionality. YAMS will now permanent redirect
to the correct URL when
* slashes are incorrectly specified (multiple slashes or missing trailing slash)
* the prefix and suffix of a filename are missed
* the prefix and suffix are included for a folder
In addition, there is now a new option that allows the re-writing of containers
as folders: .../mycontainer.html -> .../mycontainer/
Currently there is no facility for overriding this on a document by document
basis.
- Introduced a new redirection mode: "current else browser". When redirecting to
a multilingual page, if the site has been visited previously and a language
cookie has been saved, the visitor will be redirected to a page in that language.
Otherwise they will be redirected to a page based on their browser settings.
Version 1.1.6 alpha RC1
- Bug Fix: Fixed a problem whereby documents could break when loading them from
the cache.
- Bug Fix: Fixed a server config bug affecting rootname to rootname/ redirection.
- Bug Fix: Repaired a missing space in a mysql query.
Version 1.1.5 alpha
- Bug Fix: Fixed a parse bug which could occasionally involve a regular
expression grabbing too much and breaking YAMS constructs.
Version 1.1.5 alpha RC3:
- Bug Fix: Corrected a bug in breadcrumbs.101.yams.snippet.php
- Made use of the new ((yams_data:...)) construct to optimise
breadcrumbs.101.yams.snippet.php by minimising database queries.
- Renamed breadcrumbs.101.yams.snippet.php to give it the php extension.
Also included code to protect it against direct execution.
- PreParseOptimise is fairly resource intensive, so only call it if
pre-parse-optimisation is really required (that is, if there is more than one
nested yams-select construct.)
- yams_doc and yams_docr were really inefficient, because each document alias
was requiring at least one database query. Now use a cache which stores the alias
of each document in each language, as well as its parent. This can bring result
in major performance enhancements
- Updated the server config to include redirection from mysite.com/root to
mysite.com/root/
- Bug Fix: Made sure yams-in blocks get parsed on the final PostParse call. As a
result of this fix Ditto will no longer complain that it can’t find the language
file when using &language=`(yams_mname)`
- It is not necessary for PostParse to be called recursively. Fixed.
- YAMS was executing on the OnWebPageComplete event... but this was completely
unnecessary. Fixed.
- Bug Fix: Fixed misplaced PostParse argument.
- Bug Fix: Corrected a bug which would cause the current language block of a
repeat construct to be output as blank when no currentTpl was specified. (In
this case, the repeatTpl should be used.)
- Updated the StoreYamsInCallback and StoreYamsRepeatCallback to use a new
YamsCounter number rather than using the number of the block being cached.
Version 1.1.5 alpha RC2:
- Bug Fix: Corrected another URL encoding bug that would prevent incorrect
changing of language and which sometimes gave rise to blank pages.
Version 1.1.5 alpha RC1:
- Bug Fix: Corrected an URL encoding bug that would prevent incorrect changing
of language.
- Updated the Wayfinder and Ditto extensions to use [[YAMS? &get=`data`.
- Updated the manager manager rules to ensure that the template variables are
moved to tabs in the correct order. Wasn’t sure if the existing array_merge
was simply concatenating the sorted arrays.
- Updated the YAMS snippet cal to make use of the ((yams_data:... syntax.
[[YAMS? &get=`content` is now depracated and [[YAMS? &get=`data` should be
used in its place
- First implementation of the ((yams_data:docId:tvname:phx)) syntax for improved
performace through minimisation of the number of sql queries. Does not
support PHx yet. Loads data from a maximum of YAMS_DOC_LIMIT documents at time.
- Bug Fix: Fixed several bugs introduced when updating the parsing. YAMS
placeholders can now go almost anywhere.
- Fairly major changes to parsing:
- YAMS now ensures that all chunks and tvs - which may contain YAMS placholders
- are parsed on the PreParse step before handing over to MODx.
- It should now be possible to include yams placeholders in cacheable AND
uncacheable snippet calls and in chunk and tv names...
- Updated documentation to describe multilingual alias modes in more detail.
- Modified to allow the monolingual URL and (one of) the multilingual URLs
to coincide. Now, when unique multilingual aliases are not being used it
is only necessary for the multilingual language variants to be unique.
- Bug Fix: Fixed a bug whereby tv’s would be incorrectly sorted in the document
view.
- Included a How TO? for custom multilingual tvs/chunks/snippets.
- Updated the multilingual URL generation and checking so as to exclude deleted
documents.
- Bug Fix: Corrected a bug whereby YAMS would not change language when on the
site start document.
Version 1.1.4 alpha:
- Bug Fix: Corrected the Wayfinder How To? module documentation.
- Implemented automatic redirection of weblinks. This wasn’t implemented before.
This works with multilingual weblinks too. In the content fields of a
multilingual weblink it is possible to specify the same or different URLs or
docIds for each language. When using a docId, the target document will be
displayed in the same language as the source document, or the default language
if the final document is monolingual.
- Made the $yams->ConstructURL( $langId, $docId ) method public so that it can
be used as a replacement for $modx->makeUrl( $docId ) when YAMSifying existing
snippets etc.
- Bug Fix: Correct a bug in the implementation of friendly url suffixes and prefixes.
This bug made the suffixes and prefixes active at every level instead of just
the filename.
- Bug Fix: Updated the server config. It now displays the correct output when
unique multilingual aliases only are being used. It also advises on virtual
host configuration when server name mode is being used.
- Corrected a potential bug whereby the second argument of preg_quote was not
specified.
- Reorganised the params on the ’Other Params’ tab and updated the multilingual
alias text a bit.
Version 1.1.3 alpha:
- Added support for friendly alias prefixes and friendly alias suffixes.
- Bug Fix: Corrected server config bug. ${...} should have been %{...}
- Added support for phx modifiers on multilingual document variables. The
following are examples of accepted syntax:
[*#content:lcase*]
[*content:limit=`300`*]
- Replaced YAMS’ own recursive chunk parsing call an iterative call to
MODx’s mergeChunkContent. Seemed silly not to reuse existing code.
- Now YAMS maintains a list of monolingual document ids, to avoid having to
look up whether a document is multilingual in the database each time.
- Bug Fix: Fixed a bug in the server config. Was using the output query param
separator instead of the input one. As a result was getting double encoded
ampersands.
- Modified the default output query separator (used when it is not defined by
PHP) to be & rather than &.
- Bug Fix: Fixed problem whereby invalid monolingual URLs which are invalid due
to a multilingual servername being used would redirected to themselves.
- Bug Fix: Fixed a bug whereby the alias of the site-start document was being
included in the URL when using friendly alias paths and when it shouldn’t have
been because of a YAMS setting.
- Sort of bug fix: I have removed the mb_strtolower function from the URL
comparison since mbstring library is not active by default in PHP. Was going
to replace it by strtolower - which would have been safe on the encoded URL.
However, since MODx does not support case insensitive URLs anyway - so I have
removed it. True support for case insensitive URLs would be possible but would
require a bit more thought.
- Bug Fix: Fixed bug active when friendly alias paths is on which was causing
docs lower than the root to not be found.
Version 1.1.2 alpha:
- Now possible to view document using index.php?id=... So, preview from the document
tree now works again.
- Fixed a bug wherby callbacks were being registered statically when they shouldn’t
have been.
Version 1.1.1 alpha:
- Modified the default multilingual URLs generated by YAMS so that the alias
of the default language variant is the same as that of the document variable.
- Implemented a ’Unique Multilingual Aliases’ mode. This mode is activated if
unique multilingual aliases are being used. In that case it is not
necessary to specify root names or server names. YAMS can determine the language
group id and document id directly from the alias. The documentation needs
updating now.
- Improved commenting of the code a little.
- Applied proper URL encoding to the subdirectory and root name.
Version 1.1.0 alpha:
- Generalised generated query strings to use the php defined argument separator
- Added a parameter for specifying whether aliases are unique or not.
- Updated the copying over of default content for multilingual aliases.
- Now does proper encoding of URLs. Multibyte URLs are correctly encoded.
- Added correct conversion from native encoding to utf-8 to rawurlencoded and
back again for URLs and query parameters.
- Added methods for escaping and cleaning strings for embedding in (x)html/xml
documents and updated all occurrences of htmlspecialchars to use them.
- Arranged it so that the current language cookie is only set if a valid document
is found and it is multilingual.
- If a multilingual alias has not been specified, then nothing is output for the
URL.
- Incorporated mbowman’s YAMS_UX code into YAMS.
* Generalised it to function with and without friendly alias paths.
* Generalised it to function with or without multilingual alias mode
* Generalised it to take into account absent filename for site start (only
default language if using multilingual aliases).
* Fixed incorrect langId specification.
- YAMS now manages the alias document variable associated with multilingual
aliases.
- Default descriptions for Multilingual TVs created by YAMS are now in the correct
language.
- YAMS now manages a list of supported document variable types.
- Allowed (*.)localhost as a valid server name
Description:
YAMS allows users to define language groups and specify certain templates as multilingual. All documents associated with those templates are then accessible in multiple languages via different URLs. The different language versions can be distinguished by root folder name, by server name, by a query parameter, or if you are using the alpha version, by alias. Unlike other multilingual solutions, it is NOT necessary to manage multiple document trees with YAMS. Instead, all content for all languages is stored in template variables in the multilingual documents. YAMS has a ManagerManager extension that will organise the template variables for different languages onto different tabs. (See screenshot below.) YAMS is also capable of creating and managing the multilingual template variables automatically. Whether or not a template is multilingual can be configured simply via the module interface.
Multi-language content for the main document variables (pagetitle, longtitle, description, introtext, menutitle, content) is handled automatically and transparently and is subject to normal MODx caching. No special syntax is required for these document variables. For example, use [*content*] and the correct language content will appear. Standard MODx internal URLs are also automatically converted to multilingual URLs by YAMS.
In addition, YAMS provides a range of placeholders which provide access to the language tag (for use in lang="" or xml:lang=""), the language direction (for use in dir=""), language name and which allow the insertion of multilingual URLs for the current or any other document. These can be used throughout the site, including in snippet templates.
More advanced functionality is available via the YAMS snippet call. For example, via the snippet call it is possible to repeat content over multiple languages using templates. It is also possible to generate language lists or drop-down boxes in order to change language.
Since snippets are generally responsible for parsing the placeholders in templates supplied to them, like [+pagetitle+] for example, they wont automatically know to insert the correct multilingual content. For Ditto this can be overcome through the use of a special extender. For Jot this is overcome through the use of a simple extension. For the templates of other snippets it is possible to overcome this problem by replacing these placeholders by special YAMS snippet calls, eg:
[[YAMS? &get=`data` &from=`pagetitle` &docid=`[+id+]`]]
I have provided YAMS compatible default templates for Wayfinder which already include the appropriate YAMS snippet calls.
As of version 1.0.3, YAMS *should be* fully compatible with EasyLingual. See the Setup tab for instructions on how to migrate a site from EasyLingual to YAMS.
To do or in the pipeline:
- YAMS+AjaxSearch documentation on the confluence wiki.
- Allow the setting of a language dependent locale. A call to setlocale could then be made before each snippet call to ensure that locale sensitive functions (like strftime) output the most appropriate content for the given page.
- Look at alik’s custom filter and use it to create a Ditto filter that will filter out mono or multilingual documents.
- Investigate the execution of snippets. For any given page request YAMS should only execute the uncacheable snippets of the language that is requested, not the others.
- Automatic synchronisation of all document variables with the default language tvs (not just pagetitle.)
- Add option to autogenerate menutitle if blank on doc save.
- Add How To? documentation for custom templates/chunks/etc.
- Update YAMS Ditto extender to include support for special ditto placeholders. eg: [+summary+], [+link+], etc.
- Documentation: Discuss non-UTF8 multibyte support
- A step by step guide to eForm with YAMS would be useful.
- Currently YAMS manages the creation, association and disassociation of multilingual template variable versions of the following document variables: pagetitle, longtitle, description, introtext, menutitle, content. The correct language version is then automatically displayed using the standard document variable syntax: [*pagetitle*], etc. If you want to use custom multilingual template variables (eg: keywords_en, keywords_fr,...) these must be created and associated with the multilingual template variables manually, and must be inserted into documents using the [[YAMS? &get=`tv` &from=`keywords`]] snippet call. That’s fine, but I think it would be handy if it was possible to instruct YAMS to manage custom template variables in the same way as it does for the standard ones. This would allow access to the correct language version of that template variable using the standard tv syntax: [*keywords*].
- Template and document specific language disabling.
- Make the YAMS module template based and generally tidy up and compartmentalise the code.
- ... YAMR (Yet Another Multilingual Revolution) ...
Good luck!
PMS