Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing italian locale #173

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

selialkile
Copy link

@selialkile selialkile commented Feb 22, 2022

I found a problem with many Italian texts that are not interpolated correctly because it uses two different ways to load the texts. Some parts of the Wiki is using an rb.getStriong('security.error.illegalloginname') and some parts are using the MessageFormat.format( rb.getStriong('security.error.illegalloginname') ), with that is very difficult to fix all sentences that uses apostrophe in Italian.

I fixed some texts to enable the recovery password in Italian.

How to test

import java.io.*;
import java.text.MessageFormat;

class Simple{
    public static void main(String argsx[]){
	Object[] args = { "myemail@gmail.com" };
	String wrongText = MessageFormat.format("Come richiesto, la nuova password per l'autenticazione di \"{0}\" ", args);
        System.out.println("Message: " + wrongText);
        // result: Message: Come richiesto, la nuova password per lautenticazione di "{0}" 


	String correctText = MessageFormat.format("Come richiesto, la nuova password per l''autenticazione di \"{0}\" ", args);
        System.out.println("Message: " + correctText);
        // result: Message: Come richiesto, la nuova password per l'autenticazione di "myemail@gmail.com"
    }
}

Proposal of implementation

Create a new class to access the texts using the Method Overloading:

class Texts {
  public String getString(String name){
    String text = rb.getString(name);\
    Object[] args = {};
    return MessageFormat.format(text, args);
  }

  public String getString(String name, Object[] args){
    String text = rb.getString(name);
    return MessageFormat.format(text, args);
  }
}

Using that will be easier to maintain all texts with accents or symbols in a central method and an easy way to implement functions to render HTML Entities.

@juanpablo-santos
Copy link
Contributor

Hi @selialkile !

thanks for your interest in JSPWiki :-) and apologies for taking so long in answering back.

As for your proposal, may be these two default methods at InternationalizationManager are what you're looking for? IIRC, they came after JSPWiki was i18ned so that's why they're not used everywhere, as why should (note that we only use MessageFormat when the message has arguments).

As for the PR itself, running TranslationCheck for it yields the following missing untranslated strings:

Checking /CoreResources_it.properties...

Missing:
--------
comment.changenote = Comment added on {0} by {1}
rss.title.full = Aggregated RSS feed of the entire wiki
security.error.email.taken = The email ''{0}'' is already taken, you can use an email for only one profile.


Checking /plugin/PluginResources_it.properties...

Missing:
--------
insertpage.more = More...
weblogentryplugin.addcomment = <span class="icon-plus"></span> Add new comment ({0})
weblogentryplugin.more = (more)
weblogentryplugin.permalink = Permalink
weblogentryplugin.postedby = Posted by {0}&nbsp;&nbsp;


Checking /templates/default_it.properties...

Missing:
--------
actions.confirmlogout = Please confirm that you want to logout!
actions.groups = Groups
actions.registernow = Register a new user!
actions.showreaderview = Show Reader View
actions.trail = Trail
attach.add.drop = or drop them here
attach.add.select = Select files or drop them here
attach.moreinfo = Info
blog.permalink = Permalink
diff.tab = Version management
editgroup.cancel.submit = Cancel
editor.plain.autosuggest = Auto Suggest
editor.plain.comment = Leave a comment
editor.plain.comment.resize = Drag to resize the main page area
editor.plain.create = Add your page content here
editor.plain.edit.resize = Drag to resize the text and preview area
editor.plain.livepreview = Live Preview
editor.plain.localstorage.delete = Delete
editor.plain.localstorage.restore = Restore this unsaved version!
editor.plain.save.submit.comment = Post Comment
editor.plain.sidebysidepreview = Side by Side Preview
editor.plain.tbCHARS.title = Special characters
editor.plain.tbFONT.title = Font
group.actions = Actions
group.created = Created on
group.modified = Date Modified
group.thecreator = Created by
group.themodifier = Modified by
info.uploadnew.candraganddrop = or drop them here!
javascript.broken.image = Content unavailable! (broken link)
javascript.dialog.cancel = Cancel
javascript.dialog.character.entities = Character entities
javascript.dialog.confirm = Confirm
javascript.dialog.link.attributes = Wiki Link Attributes
javascript.dialog.permission = Page Permission
javascript.dialog.plugin = Plugin
javascript.dialog.principal = Roles, Groups or Users
javascript.dialog.styles = Additional Styles
javascript.dialog.toc.options = TOC options
javascript.filter.hint = Enter filter pattern (esc to clear)
javascript.preview.zone = Preview Zone
javascript.sbox.clearrecent = Clear Recent Searches
javascript.sbox.clone = Clone this page
javascript.sbox.create = Create {0}
javascript.slimbox.btn = Click to view {0}
javascript.slimbox.caption = Direct link to {0}
javascript.slimbox.size = Size: {0}px x {1}px
javascript.tablefilter = Filter Table Content
prefs.cancel.submit = Cancel
prefs.password0 = Current Password *
prefs.password1 = New Password *
prefs.user.appearance = Appearance
prefs.user.appearance.dark = Dark
prefs.user.appearance.light = Light
prefs.user.layout = Page Layout
prefs.user.layout.fixed = Fixed Width
prefs.user.layout.fluid = Full Width
prefs.user.orientation.hidden = Closed Sidebar
prefs.user.pagecookie.delete = Delete Cookie
prefs.user.pagecookies = Page Cookies
prefs.user.pagecookies.actions = Actions
prefs.user.pagecookies.page = Page
prefs.user.pagecookies.type = Cookie Type
sbox.search.button = Quick Search Menu
sbox.search.fullsearch = For full search, hit enter...
userbox.button = User Menu
workflow.beforelogin = You must log in before you can access your Workflows

is there a chance you could add them to this PR? that way we could have another language fully translated into JSPWiki O:-) If not, please do tell us so we proceed with merging this corrections, which are also appreciated anyway :-)

thx,
juan pablo

@juanpablo-santos juanpablo-santos merged commit 528c676 into apache:master Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants