Git Product home page Git Product logo

multilingual_field's Introduction

Multilingual Text Box

1 About

The multilingual version of Text Box field.

2 Installation

Dependencies:

  1. Install Text Box field if it's not already installed.
  2. Install Frontend Localisation if it's not already installed.

This extension:

  1. Upload the multilingual_field folder in this archive to your Symphony extensions folder.
  2. On Extensions page in Admin, install it by selecting Multilingual Text Box, choose Enable/Install from the With Selected menu, then click Apply.
  3. The field will be available in the list when creating a Section.

3 Update from earlier versions

  1. Upload the new version of multilingual_field folder in this archive to your Symphony extensions folder.
  2. Make sure to install and configure the Frontend Localisation with FLang detection gTLDs and Languages before 'Enable / Install' the Multilingual Text Box.
  3. On Extensions page in Admin, re-enable it by selecting Multilingual Text Box, choose Enable/Install from the With Selected menu, then click Apply.

The update process execute different Database updates, so it's recommended to backup the database before execute the upgrade.

multilingual_field's People

Contributors

6ui11em avatar beaubbe avatar jonathanwallace45 avatar jonmifsud avatar joostkamphuis avatar nathanhornby avatar nitriques avatar pascalpiche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

multilingual_field's Issues

Preferences not saved

Extension option Consolidate entry data in Symphony's Preferences has no effect - preference can't be changed nor when changed manually in config.php, it does not reflect the config's value (if no means false).

	###### MULTILINGUAL_FIELD ######
	'multilingual_field' => array(
		'consolidate' => 'no',
	),
	########

Typo error

In extension.driver.php line 120 is

$language_codes = explode(',', $_POST['settings']['language_redirect']['languages_codes']);

it should be

$language_codes = explode(',', $_POST['settings']['language_redirect']['language_codes']);

Thanks, Guillem.

XML Importer Fails

I tried using XML Importer into this, it failed at line 527. I don't know if it is feasible to use XML Importer with the Multilingual fields? Thanks.

522 if (!isset($data[$lc]) && $entry_id) {
523 continue;
524 }
525
526 // if one language fails, all fail
527 if (self::OK != parent::checkPostFieldData($data[$lc], $file_message, $entry_id)) {
528
529 $local_msg = "
[$lc] {$all_langs[$lc]}: {$file_message}";
530
531 if ($lc === $main_lang) {

filtering doesn't work

Filtering DS by this field doesn't work, also it doesn't work with select box and select box link. All this functionaities are looking for value in database tables, but this extension uses value-{$lang} column names.

Fields created before setting a language are zero-ed

Hi @6ui11em,

One of our programmers created some multilingual fields BEFORE setting a language code.
After setting the default language, all of those fields are not working, i.e., the value-lc colunm always contains 0. Other columns (value_formatted-, word_count-, handle- ) are working. Fields created after that are working just fine.
I went in the DB to check if I could spot the issue but could not find anything.

The only thing I see is the typecast you do to force string type at line 381.
Is that necessary ?

Another thing is the re-use of the $data variable inside the loop. Maybe declaring a variable inside the loop block woul be better ?
Thanks !

Upgrade from 1.4 to 2.1

I'm upgrading a site built on Symphony 2.2.5 to 2.3 and in 2.2.5 we used version 1.4 of your extension. I'm getting this error and unsure how to get things working:

14 August 2012 11:45 > UNKNOWN: GenericExceptionHandler 0 - Could not find Field <code>multilingual</code> at <code>/field.multilingual.php</code>. If it was provided by an Extension, ensure that it is installed, and enabled. in file /Users/jdsimcoe/Sites/athey-beta/symphony/lib/toolkit/class.fieldmanager.php on line 524

Here is a screenshot: http://d.pr/i/Jl8h

Bug when using with (at least) CKEditor

When saving data with field that use CKEditor applied, Symphony warning appears:

strpos() expects parameter 1 to be string, array given
/Users/grzegorz/Sites/vimuseo.fi/www-2/symphony/lib/toolkit/class.general.php line 93

I think this happens because in function checkPostFieldData you are looping through languages, and then you are checking not each value, but all language data (extension checks 3 times same data for me - I'm using 3 languages)

line 606: if (!$this->applyValidationRules($data)) {
line 616: if ($length > 0 and $length < strlen($data)) {
line 627: if (!General::validateXML($this->applyFormatting($data), $errors, false, new XsltProcess)) {

line 627 is problematic in my case, I'm not sure, but when I changed in these 3 lines $data to $value everything works.

Cross language display in entry lists

I'm working on a project with the multilingual field and I've set the required languages to the main language. In the current situation, the main language is french and my Symphony is set to English. Therefore, I can only see "None" in the entry list for the field because it cannot detect the current language.

So I thought it would be cool if it could display the value of the other language if no value in the current language is detected. It could be shown as "Foo Bar (Fr)".

Cheers!

S2.5: Multilingual values of associated entries don't get translated properly anymore

As this bug seems quite hard to explain I've created a litte "screenshot story" of what's going wrong with the multilingual field compared to the way it used to work.

My Setups are:

On the left:

  • Symphony 2.3.6
  • Text Box Field 2.3.3
  • Multilingual Text Box 3.2
  • Frontend Localisation 2.5.1

On the right:

  • Symphony 2.5.0 beta2
  • Text Box Field 2.4
  • Multilingual Text Box 3.3.1
  • Frontend Localisation 2.5.1

I also tried older versions of Text Box Field as well as the new "Association Field" instead of SBL in S2.5. The problems are the same. I haven't tested what's going on in S2.4 though.

I also haven't tested yet if this affects filtering multilingual values too, but I guess it does.

I've centered some images when both versions do the same:

s25-multilingual-field-bug-1a

"Display in entries table" option missing

I just noticed that I cannot show the multilingual field in the entries table anymore because the "display in entries table"-checkbox has vanished.

Setup: Multilingual Field 3.3.1 / Symphony 2.5.0beta2

Not PHP 7 compatible

Symphony Warning: Declaration of Extension_Multilingual_Field::update($prev_version) should be compatible with Extension::update($previousVersion = false)

JS implementation for other Multilingual * fields

There is a range of new multilingual_* fields that appeared for Symphony:

All these fields, and others if necessary, use the same idea of Language Tabs from this extension.

I'm not that skilled in JS and came up with a crude implementation that I was hoping will not conflict with Multilingual Field's js code.

Today (Friday 27 Jan 2012), @Thomas aka iwyg proposed a very neat solution for the JS implementation for Language Tabs.

I thought you might want to adopt it as well. Here's the discussion.

Wrong table name in update function

I guess $v1x_table = 'tbl_fields_multilingual_textbox'; in the update() function should be $v1x_table = 'tbl_fields_multilingual'; to reference the old table name?

Empty handle resulting from Locked Handle

Why did you include the LockedHandle feature ? Handle are not meant to be unique unless the 2nd parameter is set to true.

Uniqueness should be a 'per field' parameter. I would consider:

  • Removing this feature
    OR
  • Adding a parameter to disable it.

I loggued this as an issue, but I don't think it really is a bug. I can fork and update if you don't wanna do (or can't) do the changes.

I would also update this extension to the new version of Language Redirect extension, which as a pretty clever class, LanguageRedirect, that holds all the language and much more!

Field options ignored?

I've noticed that the field options seem to be ignore, i.e. 'Output as CDATA' and 'Use value from main language if selected language has empty value.'. Irrelevant of what's selected it seems to output the same.

Most importantly the fallback option, 'Use value from main language if selected language has empty value.' doesn't seem to work.

This is in the latest build in Symphony 2.3.1

issue with Order Entries and Publish filtering

i've got installed Field: Multilingual Text v. 1.3, Order Entries v.1.9.6, Publish Filtering v.1.6.1 in Symphony 2.2.3.
in a section with two Multilingual Fields and one Order Entries field firebug logs error:

activeTab.attr("class") is undefined
this.setActiveTab(activeTab.attr('class').split(' ')[0]);
in multilingual_field.publish.js, line 63.

Moreover, i can't drag entries to reorder and Publish filtering is hidden.

2.0 - update from 1.4

I get this error

Table 'dev_vs.sym_fields_multilingual_textbox' doesn't exist in query "SELECT SQL_CACHE field_id FROM sym_fields_multilingual_textbox"

If I manually rename the table, I get this error

MySQL Error (1050): Table 'sym_fields_multilingual_textbox' already exists in query "RENAME TABLE sym_fields_multilingual TO sym_fields_multilingual_textbox;"

Looks like a dead end...

Fatal error when updating from Symphony 2.6.9

I updated Symphony CMS to 2.7.0 and switched to PHP 7. When updating the multilingual text box field, I get a fatal error:

Symphony Fatal Error: Call to undefined method Extension_TextBoxField::updateHasUniqueKey()

An error occurred in /var/www/vhosts/profitlich.ch/httpdocs/extensions/multilingual_field/extension.driver.php around line 141
136 if (!$textboxExt->updateHasColumn('handle_unique', self::FIELD_TABLE)) {
137 $textboxExt->updateAddColumn('handle_unique', "ENUM('yes', 'no') NOT NULL DEFAULT 'yes' AFTER `text_handle`", self::FIELD_TABLE);
138 }
139
140 // add field_id unique key
141 if ($textboxExt->updateHasColumn('field_id', self::FIELD_TABLE) && !$textboxExt->updateHasUniqueKey('field_id', self::FIELD_TABLE)) {
142 $textboxExt->updateAddUniqueKey('field_id', self::FIELD_TABLE);
143 }
144
145 // add entry_id unique key 


Backtrace
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/lib/toolkit/class.extensionmanager.php:367]
    Extension_Multilingual_Field->update();
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/content/content.systemextensions.php:284]
    ExtensionManager::enable();
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/lib/toolkit/class.administrationpage.php:793]
    contentSystemExtensions->__actionIndex();
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/lib/toolkit/class.administrationpage.php:756]
    AdministrationPage->__switchboard();
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/lib/toolkit/class.administrationpage.php:459]
    AdministrationPage->action();
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/lib/core/class.administration.php:205]
    AdministrationPage->build();
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/lib/core/class.administration.php:483]
    Administration->__buildPage();
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/lib/boot/func.utilities.php:253]
    Administration->display();
[/var/www/vhosts/profitlich.ch/httpdocs/symphony/lib/boot/func.utilities.php:235]
    symphony_launcher();
[/var/www/vhosts/profitlich.ch/httpdocs/index.php:19]
    symphony();


Database Query Log
[0.0004] SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';
[0.0001] SET CHARACTER SET 'utf8';
[0.0001] SET time_zone = '+02:00';
[0.0003] SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled' ORDER BY t2.delegate, t1.name;
[0.0003] SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled';
[0.0002] SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = 'buo56o3qjb90ak8kn17dk14425' LIMIT 1;
[0.0002] SELECT SQL_CACHE * FROM `sym_extensions`;
[0.0003] SELECT SQL_CACHE a.* FROM `sym_authors` AS `a` WHERE `username` = 'mprofitl' ORDER BY a.id ASC LIMIT 1;
[0.0004] UPDATE sym_authors SET `last_seen` = '2017-08-13 16:34:20' WHERE `id` = 1;
[0.0008] SELECT SQL_CACHE `s`.* FROM `sym_sections` AS `s` ORDER BY `s`.`sortorder` asc;
[0.0012] SHOW COLUMNS FROM `sym_fields_multilingual_textbox` WHERE Field = 'handle_unique';
[0.0006] SHOW COLUMNS FROM `sym_fields_multilingual_textbox` WHERE Field = 'field_id'; 


Backend sorting is broken in 2.6

If the value is empty for the current language (but has a value in the main one), it does not uses the other main value as the sorting field.

I do not think it's fixable (since sorting in down on the database) two things could be tried:

  1. resort the php array after the SQL sort
  2. Display a visual cue to the user letting her/him know that it's the "main lang" value.

ML field does not play well with Edit Section backend

When editing a section, in which is also Multiligual Text Box field present, the backend visual gets broken down.

In the screenshot below, all other fields that follows but are not seen, are without the usual style.

I tried the latest version 3.2

image

Can't see the check "Display in entries table"

Hi there, I'm using symphony 2.5.2 with frontend localisation 2.6.0 and multilingual text box 3.4.0, and when I edit or create a multilingual text box field, I can't see the checkbox "Display in entries table".
So these fields aren't displayed on entries table.
Do you have this issue?

Optionnal message when the there is only one required language

In the section builder page, when you select only one language in the required language field, the message displayed in the entry builder page is "Optionnal" but it ain't.

It would be nice if it was written "Required in French" or "Required in Main Language [French]" or "Optionnal, exept for French"

👍 #️⃣ 🐸

Update multilingual_field from Frontend problem

Vlad,

Modifying just the current language value doesn't work on Symphony 2.3.6, 2.4, it saves the actual language field and empties the other language fields (Modify all values works.)

Doesn't work
Title
input name = "fields[title][value-{$url-fl-language}]" type ="text" />

Works

      <!--Modify all values-->
<input name="fields[title][value-nl]" type="text" />
<input name="fields[title][value-en]" type="text" />
<input name="fields[title][value-fr]" type="text" />
<input name="fields[title][value-pt]" type="text" />

No translation columns in the DB - Unknown column 'f.handle-fr' in 'where clause

I really do not know what cause this, I was running 1.3 at the time.

I did update to 1.4.1 but still no luck.

When I save/create an entry, I get Unknown column 'f.handle-fr' in 'where clause'

I think it may be related to the fact that we develop this backend specifying only one language. We did that because the client does not have a translator but wishes to translate its content later. So in LR, only one language was set.

I will investiguate more tomorrow.

Problem with required languages field

When something other than "All" is selected (i.e."main language"). After saving the modification the the section, it seemd to lose the selected value and revert back to "All"

Update in test condition

There is a case that is left outside:

This is the new condition in extension.driver.php from line 180:

    if  (   ( $callback['driver'] == 'publish' 
            &&  ( $callback['context']['page'] == 'new' || $callback['context']['page'] == 'edit') ) 
        ||  ( $callback['driver'] != 'publish' ) ){

            ....
    }

If on a publish page, then make sure it is 'new' or 'edit' OR if on any other page (for example pages generated by extensions). Example Custom Preferences.

Handles are unique even if not opted

Issue:

Unlike Text Box, handles are returned always unique, whether the Handles are unique option is selected or not.

image

Expected:

Handles should be able to not to be unique.

(Edited) Use case:

I get unwanted suffixes into page URLs which are build from ML TB handles.

Text limit only works for the default language

The text limit feature only display the good number of remaining characters of the default (first) language.

It stills validates on the server side if one of the languages value is too big. This confuses my clients a lot so I may try to fix it in the near future if you don't have time to do it.

Symphony 2.2 compatibility

I just tried your extension on symphony 2.2RC2 and it' doesn't work. Are you planning on releasing a new version soon?

Character counting

There is a JS issue when an input / textarea has CKEDitor selected. Character counter will not work no more.

Can you, please, have a look? It seems that $input.bind('blur', $update) events are not triggering.

Thank you,
Vlad

Update:

Seems that counting won't work in TinyMCE either.

Wrong string count when HTTP request encoding is different from default server encoding

I have a client that reported she typed in only 60 characters when the limit is set to 70 and she had an error reporting that there was too many chars.

I looked deeper and found out that I needed to use mb_strlen(trim($value), 'utf-8') instead of strlen($value) in order to make it work.

This is a temporary fix and I want to check with you how can we make a change in the extension while preseving which encoding the programmers use and returning the right count.

This is not an heavy or often repeated method we are dealing with so there is not fear so calling mb_strlen.

html is encoded <p> -> &gt;p&lt;

On fresh symphony install 2.6.7 and Multilingual field / textbox latest version, my html gets encoded in formated mode.. Didn't have this in Multilingual field 3.3.2.
(In the database the html is ok.)

Table encoding

From the forum:

"Multilingual field doesn’t specify a charset when creating a table and that’s why server uses default latin2. "

Could you please add default encoding set to UTF-8?

Thank you

Make unique handles optional

Generally I'm a strong proponent of unique handles, but it's not useful in every situation.

For example, I'm currenlty developing an application for location listings. The URL structure should be something like /country/city/.... Uniqueness is already created by tying a city to other modifiers like country, region, etc. But since all cities are still in one section, it's very likely to have two or more cities in different countries or regions sharing the same name, which creates unwanted unique handles like /country/city-2/.

tab position wrong with multiple fileds

if you have multiple multilingual text boxes in a section the second tab will be active when you edit an entry. if only one field is present the first tab is active as you would expect.

"Use value from main language if selected language has empty value" doesn't work

This check:

if( $this->get('def_ref_lang') === 'yes' && $data['value-'.$lang_code] === '' )

won't work because (in my case) $data['value-'.$lang_code] is NULL. Do you think changing all those checks in a more loosely form, like this:

 if( $this->get('def_ref_lang') === 'yes' && !$data['value-'.$lang_code] )

would be a good idea?

Entry not editable if field value empty

If the first field of a section is a multilingual text box and you save an entry leaving this field empty you can't go back to edit mode from clicking on the entry.

The expected behaviour is that of the core text input field which outputs "none" in the entries list and links that to the edit form.

Small bug, large consequences

This one slipped your updates. In extension.driver.php, change line 120 from

$language_codes = explode(',', $_POST['settings']['language_redirect']['languages']);

to

$language_codes = explode(',', $_POST['settings']['language_redirect']['language_codes']);

Thanks!

New mode to output all languages

This is a feature request :-)

In a recent project I hacked a new mode : all to the old version of this field to be able to replicate the backend behaviour for multi-language frontend submission. I just looped over each supported language and add the raw output to a <language> element. This is of course useful for the other multilingual fields. Maybe @vlad-ghita knows a way to add it to all multlingual fields? I haven't had a proper look into all those extensions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.