Skip to content

Commit

Permalink
Add Russian and Ukrainian localization
Browse files Browse the repository at this point in the history
  • Loading branch information
smelfungus authored and gejiaheng committed May 30, 2017
1 parent f224521 commit 50a7083
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
package com.zhihu.matisse.internal.model;

import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;

import com.zhihu.matisse.R;
import com.zhihu.matisse.internal.entity.IncapableCause;
import com.zhihu.matisse.internal.entity.Item;
import com.zhihu.matisse.internal.entity.SelectionSpec;
import com.zhihu.matisse.internal.entity.IncapableCause;
import com.zhihu.matisse.internal.ui.widget.CheckView;
import com.zhihu.matisse.internal.utils.PathUtils;
import com.zhihu.matisse.internal.utils.PhotoMetadataUtils;
Expand All @@ -37,9 +38,6 @@ public class SelectedItemCollection {

public static final String STATE_SELECTION = "state_selection";
public static final String STATE_COLLECTION_TYPE = "state_collection_type";
private final Context mContext;
private Set<Item> mItems;

/**
* Empty collection
*/
Expand All @@ -56,7 +54,8 @@ public class SelectedItemCollection {
* Collection with images and videos.
*/
public static final int COLLECTION_MIXED = COLLECTION_IMAGE | COLLECTION_VIDEO;

private final Context mContext;
private Set<Item> mItems;
private int mCollectionType = COLLECTION_UNDEFINED;

public SelectedItemCollection(Context context) {
Expand Down Expand Up @@ -169,8 +168,23 @@ public boolean isSelected(Item item) {

public IncapableCause isAcceptable(Item item) {
if (maxSelectableReached()) {
return new IncapableCause(mContext.getString(R.string.error_over_count,
SelectionSpec.getInstance().maxSelectable));
int maxSelectable = SelectionSpec.getInstance().maxSelectable;
String cause;

try {
cause = mContext.getResources().getQuantityString(
R.plurals.error_over_count,
maxSelectable,
maxSelectable
);
} catch (Resources.NotFoundException e) {
cause = mContext.getString(
R.string.error_over_count,
maxSelectable
);
}

return new IncapableCause(cause);
} else if (typeConflict(item)) {
return new IncapableCause(mContext.getString(R.string.error_type_conflict));
}
Expand Down
40 changes: 40 additions & 0 deletions matisse/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 Zhihu Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<string name="album_name_all">Все</string>

<string name="button_preview">Предпросмотр</string>
<string name="button_apply_default">Применить</string>
<string name="button_apply">Применить(%1$d)</string>
<string name="button_back">Назад</string>
<string name="photo_grid_capture">Камера</string>
<string name="empty_text">Пусто</string>
<string name="button_ok">OK</string>

<string name="error_over_count_default">Вы выбрали максимальное количество файлов</string>
<plurals name="error_over_count">
<item quantity="one">Можно выбрать не более %1$d файла</item>
<item quantity="few">Можно выбрать не более %1$d файлов</item>
<item quantity="many">Можно выбрать не более %1$d файлов</item>
<item quantity="other">Можно выбрать не более %1$d файлов</item>
</plurals>
<string name="error_under_quality">Слишком низкое качество</string>
<string name="error_over_quality">Слишком высокое качество</string>
<string name="error_file_type">Неподдерживаемый тип файла</string>
<string name="error_type_conflict">Невозможно выбрать изображения и видео одновременно</string>
<string name="error_no_video_activity">Приложение для предпросмотра видео не найдено</string>
</resources>
40 changes: 40 additions & 0 deletions matisse/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2017 Zhihu Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<string name="album_name_all">Всі</string>

<string name="button_preview">Перегляд</string>
<string name="button_apply_default">Застосувати</string>
<string name="button_apply">Застосувати(%1$d)</string>
<string name="button_back">Назад</string>
<string name="photo_grid_capture">Камера</string>
<string name="empty_text">Пусто</string>
<string name="button_ok">OK</string>

<string name="error_over_count_default">Вы обрали максимальну кількість файлів</string>
<plurals name="error_over_count">
<item quantity="one">Можливо обрати не більше %1$d файла</item>
<item quantity="few">Можливо обрати не більше %1$d файлів</item>
<item quantity="many">Можливо обрати не більше %1$d файлів</item>
<item quantity="other">Можливо обрати не більше %1$d файлів</item>
</plurals>
<string name="error_under_quality">Занадто низька якість</string>
<string name="error_over_quality">Занадто висока якість</string>
<string name="error_file_type">Непідтримуваний тип файла</string>
<string name="error_type_conflict">Неможливо обрати зображення і відео одночасно</string>
<string name="error_no_video_activity">Застосунок для перегляду відео не знайдений</string>
</resources>

0 comments on commit 50a7083

Please sign in to comment.